diff options
| author | star9029 <[email protected]> | 2023-09-09 17:35:52 +0800 |
|---|---|---|
| committer | star9029 <[email protected]> | 2023-09-09 17:35:52 +0800 |
| commit | 98aac22f41b987bb38d4e5f82da86276895b3a93 (patch) | |
| tree | 8bbf83aba2c9a25809a6c1bee1f659b9547c30f6 | |
| parent | e72c760f2458c93167b508ab77732bb8eec7a44c (diff) | |
improve windows asan program
| -rw-r--r-- | xmake/rules/mode/xmake.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/xmake/rules/mode/xmake.lua b/xmake/rules/mode/xmake.lua index 2bc812d2e..3733805e8 100644 --- a/xmake/rules/mode/xmake.lua +++ b/xmake/rules/mode/xmake.lua @@ -208,6 +208,15 @@ rule("mode.asan") target:add("mxflags", "-fsanitize=address") target:add("ldflags", "-fsanitize=address") target:add("shflags", "-fsanitize=address") + + if target:is_plat("windows") and target:kind() == "binary" then + local envs = target:toolchain("msvc"):runenvs() + local vscmd_ver = envs["VSCMD_VER"] + if vscmd_ver and vscmd_ver:startswith("17.7") then + local cl = assert(import("lib.detect.find_tool").find_tool("cl", {envs = envs}), "cl not found!") + target:add("runenvs", "PATH", path.directory(cl.program)) + end + end end end) |
