From 7a3bb3c3b011253cccb609295b2aa819a9a07382 Mon Sep 17 00:00:00 2001 From: Will Date: Sat, 26 Oct 2024 12:25:51 -0400 Subject: [PATCH] build/cmake: fixup allowed sanitizer logic --- CMakeLists.txt | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6adcb7c..4b03700 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,16 +126,16 @@ set(ALLOWED_stacksan 0) set(ALLOWED_dataflowsan 0) set(ALLOWED_cfisan 0) set(ALLOWED_kcfisan 0) -if(NOT WIN32 OR NOT BUILD_ASAN OR NOT BUILD_SAN) +if(NOT WIN32 AND (BUILD_ASAN OR BUILD_SAN)) set(ALLOWED_asan 1) endif() -if(IS_CC_CLANG OR NOT BUILD_MSAN OR NOT BUILD_SAN) +if(IS_CC_CLANG AND (BUILD_MSAN OR BUILD_SAN)) set(ALLOWED_msan 1) endif() -if(NOT ANDROID OR NOT WIN32 OR NOT BUILD_TSAN OR NOT BUILD_SAN) +if(NOT ANDROID AND NOT WIN32 AND (BUILD_TSAN OR BUILD_SAN)) set(ALLOWED_tsan 1) endif() -if(NOT WIN32 OR NOT BUILD_UBSAN OR NOT BUILD_SAN) +if(NOT WIN32 AND (BUILD_UBSAN OR BUILD_SAN)) set(ALLOWED_ubsan 1) endif() set(SAN_NAMES "asan" "msan" "tsan" "ubsan") @@ -332,10 +332,8 @@ function(wtr_add_autosan_bin_target NAME SRC_SET IS_TEST) endif() foreach(SAN ${SAN_NAMES}) string(TOUPPER ${SAN} UPPER_SAN) - if(NOT BUILD_SAN) - message(STATUS "${NAME}.${SAN}: Skipped (BUILD_SAN=${BUILD_SAN})") - elseif(NOT BUILD_${UPPER_SAN}) - message(STATUS "${NAME}.${SAN}: Skipped (BUILD_${UPPER_SAN}=${BUILD_${UPPER_SAN}})") + if(NOT BUILD_SAN AND NOT BUILD_${UPPER_SAN}) + message(STATUS "${NAME}.${SAN}: Skipped (BUILD_SAN=${BUILD_SAN}, BUILD_${UPPER_SAN}=${BUILD_${UPPER_SAN}})") elseif(NOT ALLOWED_${SAN}) message(STATUS "${NAME}.${SAN}: Skipped (Unsupported on ${CMAKE_SYSTEM}/${CMAKE_CXX_COMPILER_ID})") elseif(IS_TEST) @@ -351,11 +349,8 @@ function(wtr_add_san_lib_target NAME OUTPUT_NAME SRC_SET INC_SET LIB_TYPE SAN) if (NOT BUILD_LIB) message(STATUS "${NAME}: Skipped (BUILD_LIB=${BUILD_LIB})") return() - elseif (NOT BUILD_SAN) - message(STATUS "${NAME}: Skipped (BUILD_SAN=${BUILD_SAN})") - return() - elseif (NOT BUILD_${UPPER_SAN}) - message(STATUS "${NAME}: Skipped (BUILD_${UPPER_SAN}=${BUILD_${UPPER_SAN}})") + elseif (NOT BUILD_SAN AND NOT BUILD_${UPPER_SAN}) + message(STATUS "${NAME}: Skipped (BUILD_SAN=${BUILD_SAN}, BUILD_${UPPER_SAN}=${BUILD_${UPPER_SAN}})") return() elseif (NOT ALLOWED_${SAN}) message(STATUS "${NAME}: Skipped (Unsupported on ${CMAKE_SYSTEM}/${CMAKE_CXX_COMPILER_ID})")