summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/modules/core/tools/cl/has_flags.lua27
1 files changed, 25 insertions, 2 deletions
diff --git a/xmake/modules/core/tools/cl/has_flags.lua b/xmake/modules/core/tools/cl/has_flags.lua
index 48884b340..57c5d2d0c 100644
--- a/xmake/modules/core/tools/cl/has_flags.lua
+++ b/xmake/modules/core/tools/cl/has_flags.lua
@@ -28,15 +28,38 @@ 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"})
+ known_flags = hashset.from({
+ "-Ox", "-O1", "-O2", "-Od",
+ "-MT", "-MD", "-MTd", "-MDd",
+ "-EHsc", "-EHa", "-EHs",
+ "-W0", "-W1", "-W2", "-W3", "-W4", "-Wall", "-WX",
+ "-Z7", "-Zi", "-ZI",
+ "-c", "-nologo", "-FS", "-FC", "-Gm-",
+ "-GR", "-GR-", "-GS", "-GS-",
+ "-Gy", "-Gy-", "-GL",
+ "-Gd", "-Gr", "-Gz", "-Gv",
+ "-TC", "-TP",
+ "-utf-8", "-bigobj", "-MP",
+ "-showIncludes"
+ })
_g.known_flags = known_flags
end
if known_flags:has(flag) then
return true
end
+ -- check flags with known prefixes that always accept values (all MSVC versions)
if flag:startswith("-D") or
flag:startswith("-U") or
- flag:startswith("-I") then
+ flag:startswith("-I") or
+ flag:startswith("-Fo") or
+ flag:startswith("-Fe") or
+ flag:startswith("-Fd") or
+ flag:startswith("-Fi") or
+ flag:startswith("-Fp") or
+ flag:startswith("-FI") or -- force include
+ flag:startswith("-wd") or -- e.g. /wd4251
+ flag:startswith("-we") or -- e.g. /we4062
+ flag:startswith("-wo") then
return true
end
end