diff options
| author | ruki <[email protected]> | 2022-02-26 00:43:13 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-02-26 00:43:13 +0800 |
| commit | 9d77af7a00a833e0d42c0815877c6dc0ad5c4498 (patch) | |
| tree | ba287ab375d7e9805812b94bbe6bcf8bf92748da /xmake/modules/detect/tools/cl/has_flags.lua | |
| parent | df4777bc2a897d054e4a5706fa2a34393b37c815 (diff) | |
improve cl/has_flags
Diffstat (limited to 'xmake/modules/detect/tools/cl/has_flags.lua')
| -rw-r--r-- | xmake/modules/detect/tools/cl/has_flags.lua | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/xmake/modules/detect/tools/cl/has_flags.lua b/xmake/modules/detect/tools/cl/has_flags.lua index 1c7f65325..ceb3561d4 100644 --- a/xmake/modules/detect/tools/cl/has_flags.lua +++ b/xmake/modules/detect/tools/cl/has_flags.lua @@ -19,28 +19,15 @@ -- -- imports -import("core.cache.detectcache") import("core.language.language") +import("core.cache.global_detectcache") -- attempt to check it from the argument list function _check_from_arglist(flags, opt) - - -- only one flag? - if #flags > 1 then - return - end - - -- make cache key local key = "detect.tools.cl.has_flags" - - -- make allflags key local flagskey = opt.program .. "_" .. (opt.programver or "") - - -- get all allflags from argument list - local allflags = detectcache:get2(key, flagskey) + local allflags = global_detectcache:get2(key, flagskey) if not allflags then - - -- get argument list allflags = {} local arglist = os.iorunv(opt.program, {"-?"}, {envs = opt.envs}) if arglist then @@ -48,12 +35,14 @@ function _check_from_arglist(flags, opt) allflags[arg:gsub("/", "-")] = true end end - - -- save cache - detectcache:set2(key, flagskey, allflags) - detectcache:save() + global_detectcache:set2(key, flagskey, allflags) + global_detectcache:save() + end + local flag = flags[1]:gsub("/", "-") + if flag:startswith("-D") or flag:startswith("-I") then + return true end - return allflags[flags[1]:gsub("/", "-")] + return allflags[flag] end -- get extension |
