summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-05-12 11:41:58 +0800
committerruki <[email protected]>2017-05-12 11:41:58 +0800
commit376e697ab8c71f75aafaf5b34524206936988aaf (patch)
treec9117f74b695837eeaa0e3a3674e8dfbbbe54015
parent826fcdbef58c2c1914f5a8dc31a19c97b682af68 (diff)
fix link target deps bug
-rw-r--r--xmake/core/tool/builder.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index a79b7c902..93027ed86 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -156,25 +156,26 @@ end
function builder:_addflags_from_targetdeps(results, target, flagname)
-- for all target deps
+ local targetkind = target:targetkind()
for _, dep in ipairs(target:deps()) do
-- is static or shared target library? link it
- local targetkind = dep:targetkind()
- if targetkind == "static" or targetkind == "shared" then
- if flagname == "links" then
+ local depkind = dep:targetkind()
+ if depkind == "static" or depkind == "shared" then
+ if flagname == "links" and (targetkind == "binary" or targetkind == "shared") then
-- add dependent link
- local link, ok = path.filename(dep:targetfile()):gsub(target.filename("([%w_]+)", targetkind):gsub("%.", "%%.") .. "$", "%1")
+ local link, ok = path.filename(dep:targetfile()):gsub(target.filename("([%w_]+)", depkind):gsub("%.", "%%.") .. "$", "%1")
if link and ok > 0 then
table.insert(results, link)
end
- elseif flagname == "linkdirs" then
+ elseif flagname == "linkdirs" and (targetkind == "binary" or targetkind == "shared") then
-- add dependent linkdirs
table.insert(results, path.directory(dep:targetfile()))
- elseif flagname == "rpathdirs" then
+ elseif flagname == "rpathdirs" and targetkind == "binary" then
-- add dependent rpathdirs (need absolute path)
table.insert(results, path.directory(path.absolute(dep:targetfile(), xmake._PROJECT_DIR)))