summaryrefslogtreecommitdiff
path: root/xmake/core/base/scopeinfo.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-01-01 21:02:28 +0800
committerruki <[email protected]>2021-01-01 21:02:28 +0800
commite1e70e4d1867f92f5591e7dd068ca13819955ed4 (patch)
tree9c4ddbf7c91099b36def727dd578188fc53b4da4 /xmake/core/base/scopeinfo.lua
parent99126a6271f7ed8a4712d5cd5c060210090b8d1c (diff)
add after_load to add_requires
Diffstat (limited to 'xmake/core/base/scopeinfo.lua')
-rw-r--r--xmake/core/base/scopeinfo.lua29
1 files changed, 28 insertions, 1 deletions
diff --git a/xmake/core/base/scopeinfo.lua b/xmake/core/base/scopeinfo.lua
index 45a7761f2..70755e14a 100644
--- a/xmake/core/base/scopeinfo.lua
+++ b/xmake/core/base/scopeinfo.lua
@@ -519,7 +519,7 @@ end
-- function (target)
-- _instance:extraconf("includedirs", "inc", "public") -> true
-- _instance:extraconf("includedirs", "inc") -> {public = true}
--- _instance:extraconf("includedirs") -> {["inc"] = {public = true}}
+-- _instance:extraconf("includedirs") -> {inc = {public = true}}
-- end
--
function _instance:extraconf(name, item, key)
@@ -549,6 +549,33 @@ function _instance:extraconf(name, item, key)
return value
end
+-- set the extra configuration
+--
+-- e.g.
+--
+-- add_includedirs("inc", {public = true})
+--
+-- function (target)
+-- _instance:extraconf_set("includedirs", "inc", "public", true)
+-- _instance:extraconf_set("includedirs", "inc", {public = true})
+-- _instance:extraconf_set("includedirs", {inc = {public = true}})
+-- end
+--
+function _instance:extraconf_set(name, item, key, value)
+ if key ~= nil then
+ local extraconf = self:get("__extra_" .. name) or {}
+ if value ~= nil then
+ extraconf[item] = extraconf[item] or {}
+ extraconf[item][key] = value
+ else
+ extraconf[item] = key
+ end
+ self:set("__extra_" .. name, extraconf)
+ else
+ self:set("__extra_" .. name, item)
+ end
+end
+
-- clone a new instance from the current
function _instance:clone()
return _instance.new(self:kind(), self:info(), {interpreter = self:interpreter(), remove_repeat = self._REMOVE_REPEAT, enable_filter = self._ENABLE_FILTER})