summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-06-29 23:04:57 +0800
committerruki <[email protected]>2020-06-29 12:29:42 +0800
commita9c57a3ca9b3cd4e94905e7b7429689273915f01 (patch)
tree171c7ee5cc5cb73e866c2bc832e5477f48f684ad
parent5fc92e63d8ca58cc3ebfc2934ba0e5a0ce38fe7b (diff)
improve target object file
-rw-r--r--xmake/core/project/target.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 14409fec4..652ae4758 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -860,7 +860,11 @@ function _instance:autogenfile(sourcefile, opt)
relativedir = relativedir:gsub(":[\\/]*", '\\') -- replace C:\xxx\ => C\xxx\
end
relativedir = relativedir:gsub("%.%.", "__")
- return path.join((opt and opt.rootdir) and opt.rootdir or self:autogendir(), relativedir, (opt and opt.filename) and opt.filename or path.filename(sourcefile))
+ local rootdir = (opt and opt.rootdir) and opt.rootdir or self:autogendir()
+ if relativedir ~= "." then
+ rootdir = path.join(rootdir, relativedir)
+ end
+ return path.join(rootdir, (opt and opt.filename) and opt.filename or path.filename(sourcefile))
end
-- get the target kind