diff options
| author | DownerCase <[email protected]> | 2025-06-20 18:11:48 +0100 |
|---|---|---|
| committer | DownerCase <[email protected]> | 2025-06-20 18:16:09 +0100 |
| commit | 749d449e2ff77f43771467b986aa203546f3a808 (patch) | |
| tree | 5659fc8f52b03ebe17ac42ed3ec2043b3de34975 /xmake/rules/c++ | |
| parent | 9da165f03d6967aa1c82836527eb22702745421a (diff) | |
fix: Do not add -fsanitize flags to msvc linker
msvc's link.exe does not have an `fsanitize` flag.
It was not causing build failures by was creating warning messages like:
LINK : warning LNK4044: unrecognized option '/fsanitize=address'; ignored
Diffstat (limited to 'xmake/rules/c++')
| -rw-r--r-- | xmake/rules/c++/build_sanitizer/config.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/xmake/rules/c++/build_sanitizer/config.lua b/xmake/rules/c++/build_sanitizer/config.lua index b2480eb73..1a82090fe 100644 --- a/xmake/rules/c++/build_sanitizer/config.lua +++ b/xmake/rules/c++/build_sanitizer/config.lua @@ -41,7 +41,8 @@ function _add_build_sanitizer(target, sourcekind, checkmode) end -- add ldflags and shflags - if target:has_tool("ld", "link", "clang", "clangxx", "gcc", "gxx") then + -- msvc does not have an fsanitize linker flag, so the 'link' tool is excluded + if target:has_tool("ld", "clang", "clangxx", "gcc", "gxx") then target:add("ldflags", "-fsanitize=" .. checkmode, {force = true}) target:add("shflags", "-fsanitize=" .. checkmode, {force = true}) end |
