summaryrefslogtreecommitdiff
path: root/xmake/includes/check_cflags.lua
diff options
context:
space:
mode:
authorxq114 <[email protected]>2021-09-23 21:59:21 +0800
committerxq114 <[email protected]>2021-09-23 21:59:21 +0800
commit6e5bd0a99336d5ef17e9b7c312d547b6a683d13e (patch)
tree628cf31298c0554d98278af8cefb25c6719eb665 /xmake/includes/check_cflags.lua
parentfbccc2375dba05f227ff8e6ec0b61c9357ca449d (diff)
improve configvar_check_ functions
Diffstat (limited to 'xmake/includes/check_cflags.lua')
-rw-r--r--xmake/includes/check_cflags.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/xmake/includes/check_cflags.lua b/xmake/includes/check_cflags.lua
index 85ee65f8e..46758d0aa 100644
--- a/xmake/includes/check_cflags.lua
+++ b/xmake/includes/check_cflags.lua
@@ -53,7 +53,9 @@ function configvar_check_cflags(definition, flags, opt)
local optname = "__" .. (opt.name or definition)
local defname, defval = unpack(definition:split('='))
option(optname)
- set_configvar(defname, defval or 1)
+ if opt.default == nil then
+ set_configvar(defname, defval or 1, {quote = opt.quote})
+ end
on_check(function (option)
import("core.tool.compiler")
if compiler.has_flags("c", flags, opt) then
@@ -61,5 +63,9 @@ function configvar_check_cflags(definition, flags, opt)
end
end)
option_end()
- add_options(optname)
+ if opt.default == nil then
+ add_options(optname)
+ else
+ set_configvar(defname, has_config(optname) and (defval or 1) or opt.default, {quote = opt.quote})
+ end
end