summaryrefslogtreecommitdiff
path: root/xmake/core/project/config.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-01-09 00:44:44 +0800
committerruki <[email protected]>2025-01-09 00:44:44 +0800
commita74774a809de30e6e473157233aa47bbabb272d4 (patch)
tree772dce6b904c7693c1c19695b172eee1a43df2f8 /xmake/core/project/config.lua
parent672112971ac26e4ed5bc5789938a82e8dbc22c86 (diff)
improve has_config
Diffstat (limited to 'xmake/core/project/config.lua')
-rw-r--r--xmake/core/project/config.lua15
1 files changed, 11 insertions, 4 deletions
diff --git a/xmake/core/project/config.lua b/xmake/core/project/config.lua
index 650bbc4a6..d4d510c09 100644
--- a/xmake/core/project/config.lua
+++ b/xmake/core/project/config.lua
@@ -297,10 +297,17 @@ function config.is_value(name, ...)
end
-- has the given configs?
-function config.has(...)
- for _, name in ipairs(table.pack(...)) do
- if name and type(name) == "string" and config.get(name) then
- return true
+function config.has(names, opt)
+ opt = opt or {}
+ for _, name in ipairs(names) do
+ if name and type(name) == "string" then
+ local value = config.get(name)
+ if value == nil and opt.namespace then
+ value = config.get(opt.namespace .. "::" .. name)
+ end
+ if value then
+ return true
+ end
end
end
return false