summaryrefslogtreecommitdiff
path: root/xmake/core
diff options
context:
space:
mode:
authorruki <[email protected]>2017-08-16 09:15:45 +0800
committerruki <[email protected]>2017-08-16 09:15:45 +0800
commit66299aec15e67cb7d96ecc580b29b3441b399dfa (patch)
treeddf4dde3dbab466b0f8a31897e064932a0106d9c /xmake/core
parentb92d83c523045d7e8b716dc0610b88b0d357575f (diff)
improve add_deps to add inherit config
Diffstat (limited to 'xmake/core')
-rw-r--r--xmake/core/project/target.lua20
-rw-r--r--xmake/core/tool/builder.lua7
2 files changed, 23 insertions, 4 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 4c78b56c3..762c131bd 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -151,7 +151,7 @@ function target:linkflags()
return self:linker():linkflags({target = self})
end
--- get the given dependent option
+-- get the given dependent target
function target:dep(name)
local deps = self:deps()
if deps then
@@ -169,6 +169,24 @@ function target:orderdeps()
return self._ORDERDEPS
end
+-- get the given dependent config
+function target:depconfig(name)
+
+ -- get deps config
+ --
+ -- .e.g {inherit = false}
+ --
+ local depsconfig = self._DEPSCONFIG
+ if not depsconfig then
+ depsconfig = {}
+ for depname, depconfig in pairs(table.wrap(self:get("__extra_deps"))) do
+ depsconfig[depname] = depconfig
+ end
+ self._DEPSCONFIG = depsconfig
+ end
+ return depsconfig[name]
+end
+
-- is phony target?
function target:isphony()
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index d67d407ce..7d02930f0 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -137,9 +137,10 @@ function builder:_inherit_from_targetdeps(results, target, flagname)
local dep = orderdeps[total + 1 - idx]
-- is static or shared target library? link it
- local depkind = dep:get("kind")
- local targetkind = target:get("kind")
- if depkind == "static" or depkind == "shared" then
+ local depkind = dep:get("kind")
+ local targetkind = target:get("kind")
+ local depconfig = table.wrap(target:depconfig(dep:name()))
+ if (depkind == "static" or depkind == "shared") and (depconfig.inherit == nil or depconfig.inherit) then
if flagname == "links" and (targetkind == "binary" or targetkind == "shared") then
-- add dependent link