diff options
Diffstat (limited to 'xmake/core/base/scopeinfo.lua')
| -rw-r--r-- | xmake/core/base/scopeinfo.lua | 29 |
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}) |
