diff options
| author | ruki <[email protected]> | 2025-09-18 23:25:45 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-09-18 23:25:45 +0800 |
| commit | dd46b5b5089cfa1edda87347628c5e40e34b0efb (patch) | |
| tree | 925fefbe7e9ecd79c6331eda62814cf6fdba8675 | |
| parent | f737997eddc40fa5fea7864e7c7bd28e618ba749 (diff) | |
improve cl has_flags
| -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 |
