diff options
| author | ruki <[email protected]> | 2017-11-17 22:29:17 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-11-17 08:55:47 +0800 |
| commit | b627fef0a708077fcd41808aa61e1807eed66b0e (patch) | |
| tree | 1bacacb6b9d54f8bae391cca10fd6e66de9f2c19 | |
| parent | d6c77c3a850f3c32c4f62ed6bb80015f6326fda1 (diff) | |
fix add_files with the absolute path
| -rw-r--r-- | xmake/core/project/target.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 752459ce1..a1847be4c 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -569,14 +569,14 @@ function target:objectfile(sourcefile) -- we need replace '..' to '__' in this case -- local sourcedir = path.directory(sourcefile) - if path.is_absolute(sourcedir) then - sourcedir = path.relative(sourcedir, objectdir) + if path.is_absolute(sourcedir) and os.host() == "windows" then + sourcedir = sourcedir:gsub(":[\\/]*", '\\') -- replace C:\xxx\ => C\xxx\ end sourcedir = sourcedir:gsub("%.%.", "__") -- make object file -- full file name(not base) to avoid name-clash of object file - return string.format("%s/%s/%s/%s", objectdir, self:name(), sourcedir, target.filename(path.filename(sourcefile), "object")) + return path.join(objectdir, self:name(), sourcedir, target.filename(path.filename(sourcefile), "object")) end -- get the object files |
