diff options
| -rw-r--r-- | xmake/modules/core/tools/cl/has_flags.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/xmake/modules/core/tools/cl/has_flags.lua b/xmake/modules/core/tools/cl/has_flags.lua index 487338a0b..fe0429cda 100644 --- a/xmake/modules/core/tools/cl/has_flags.lua +++ b/xmake/modules/core/tools/cl/has_flags.lua @@ -25,6 +25,14 @@ import("core.cache.global_detectcache") -- attempt to check it from known flags function _check_from_knownargs(flags, opt) local flag = flags[1]:gsub("/", "-") + local known_flags = _g.known_flags + if known_flags == nil then + known_flags = hashset.from({"-Ox", "-O1", "-O2", "-Od", "-MT", "-MD", "-MTd", "-MDd", "-EHsc"}) + _g.known_flags = known_flags + end + if known_flags:has(flag) then + return true + end if flag:startswith("-D") or flag:startswith("-U") or flag:startswith("-I") then @@ -105,10 +113,10 @@ function main(flags, opt) -- attempt to check it from the argument list opt = opt or {} if not opt.tryrun then - if _check_from_arglist(flags, opt) then + if _check_from_knownargs(flags, opt) then return true end - if _check_from_knownargs(flags, opt) then + if _check_from_arglist(flags, opt) then return true end end |
