summaryrefslogtreecommitdiff
path: root/xmake/core/base/scopeinfo.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-03-02 23:20:48 +0800
committerruki <[email protected]>2022-03-02 23:20:48 +0800
commitcfdffbc896a2999c594caccfdaa323df16e3950b (patch)
tree233d14b1ac1e8c918b0d1e23aa76f87b06e4e69e /xmake/core/base/scopeinfo.lua
parent6026401e3bc55e0b5974c0aa18aefe4d7135fe89 (diff)
improve table.wrap and unwrap
Diffstat (limited to 'xmake/core/base/scopeinfo.lua')
-rw-r--r--xmake/core/base/scopeinfo.lua18
1 files changed, 16 insertions, 2 deletions
diff --git a/xmake/core/base/scopeinfo.lua b/xmake/core/base/scopeinfo.lua
index e3d9a8500..02fb89299 100644
--- a/xmake/core/base/scopeinfo.lua
+++ b/xmake/core/base/scopeinfo.lua
@@ -113,8 +113,18 @@ function _instance:_api_set_values(name, ...)
extra_config = nil
end
- -- expand values
- if not extra_config or extra_config.expand ~= false then
+ -- @note we need mark table value as meta object to avoid wrap/unwrap
+ -- if these values cannot be expanded, especially when there is only one value
+ --
+ -- e.g. target:set("shflags", {"-Wl,-exported_symbols_list", exportfile}, {force = true, expand = false})
+ if extra_config and extra_config.expand == false then
+ for _, value in ipairs(values) do
+ if type(value) == "table" then
+ setmetatable(value, {})
+ end
+ end
+ else
+ -- expand values
values = table.join(table.unpack(values))
end
@@ -154,6 +164,10 @@ function _instance:_api_add_values(name, ...)
extra_config = nil
end
+ -- @note we need mark table value as meta object to avoid wrap/unwrap
+ -- if these values cannot be expanded, especially when there is only one value
+ --
+ -- e.g. target:add("shflags", {"-Wl,-exported_symbols_list", exportfile}, {force = true, expand = false})
if extra_config and extra_config.expand == false then
for _, value in ipairs(values) do
if type(value) == "table" then