summaryrefslogtreecommitdiff
path: root/xmake/includes/check_macros.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-10-02 23:29:03 +0800
committerruki <[email protected]>2021-10-02 23:29:03 +0800
commite80a41789b0de5f2249c15d57486fd3a4b40ff99 (patch)
treef3a893345c8da889236e68775dc3de92f1a092e9 /xmake/includes/check_macros.lua
parentd4789ff5e968294bf2e9831209d0cf61b61c9d43 (diff)
save and restore scope
Diffstat (limited to 'xmake/includes/check_macros.lua')
-rw-r--r--xmake/includes/check_macros.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/xmake/includes/check_macros.lua b/xmake/includes/check_macros.lua
index ec4beddce..0ed879c95 100644
--- a/xmake/includes/check_macros.lua
+++ b/xmake/includes/check_macros.lua
@@ -30,6 +30,7 @@ function check_macros(definition, macros, opt)
opt = opt or {}
local optname = "__" .. (opt.name or definition)
local snippets = {}
+ save_scope()
option(optname)
for _, macro in ipairs(macros) do
if macro:find(' ', 1, true) then
@@ -67,6 +68,7 @@ function check_macros(definition, macros, opt)
add_cxxflags(opt.cxxflags)
end
option_end()
+ restore_scope()
add_options(optname)
end
@@ -81,6 +83,7 @@ function configvar_check_macros(definition, macros, opt)
local optname = "__" .. (opt.name or definition)
local defname, defval = unpack(definition:split('='))
local snippets = {}
+ save_scope()
option(optname)
for _, macro in ipairs(macros) do
if macro:find(' ', 1, true) then
@@ -120,6 +123,7 @@ function configvar_check_macros(definition, macros, opt)
add_cxxflags(opt.cxxflags)
end
option_end()
+ restore_scope()
if opt.default == nil then
add_options(optname)
else