summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/rules/c++/build_sanitizer/config.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/xmake/rules/c++/build_sanitizer/config.lua b/xmake/rules/c++/build_sanitizer/config.lua
index 7c8d4f0da..4b6bd9845 100644
--- a/xmake/rules/c++/build_sanitizer/config.lua
+++ b/xmake/rules/c++/build_sanitizer/config.lua
@@ -51,8 +51,11 @@ end
function main(target, sourcekind)
local sanitizer = false
for _, checkmode in ipairs({"address", "thread", "memory", "leak", "undefined"}) do
- if target:policy("build.sanitizer." .. checkmode) or
- project.policy("build.sanitizer." .. checkmode) then
+ local enabled = target:policy("build.sanitizer." .. checkmode)
+ if enabled == nil then
+ enabled = project.policy("build.sanitizer." .. checkmode)
+ end
+ if enabled then
_add_build_sanitizer(target, sourcekind, checkmode)
sanitizer = true
end