Skip to content

Commit

Permalink
build/cmake: fixup allowed sanitizer logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Will committed Oct 26, 2024
1 parent 3680d99 commit 7a3bb3c
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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})")
Expand Down

0 comments on commit 7a3bb3c

Please sign in to comment.