From 19f97d47ac725a7392f0bde5921043f0add21074 Mon Sep 17 00:00:00 2001 From: M Starch Date: Fri, 22 Nov 2024 17:11:48 -0800 Subject: [PATCH] Default sanitizers to ON when BUILD_TESTING (#3045) --- cmake/options.cmake | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/cmake/options.cmake b/cmake/options.cmake index 14bf504911..bce3831293 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -198,11 +198,13 @@ option(FPRIME_CHECK_FRAMEWORK_VERSION "(Internal) Check framework version when b # # **Values:** # - ON: enables AddressSanitizer. -# - OFF: (default) does not enable AddressSanitizer. +# - OFF: does not enable AddressSanitizer. # -# e.g. `-DENABLE_SANITIZER_ADDRESS=ON` +# Defaults to ON when BUILD_TESTING is ON +# +# e.g. `-DENABLE_SANITIZER_ADDRESS=OFF` #### -option(ENABLE_SANITIZER_ADDRESS "Enable address sanitizer" OFF) +option(ENABLE_SANITIZER_ADDRESS "Enable address sanitizer" BUILD_TESTING) #### # `ENABLE_SANITIZER_LEAK:` @@ -215,11 +217,13 @@ option(ENABLE_SANITIZER_ADDRESS "Enable address sanitizer" OFF) # # **Values:** # - ON: enables LeakSanitizer. -# - OFF: (default) does not enable LeakSanitizer. +# - OFF: does not enable LeakSanitizer. +# +# Defaults to ON when BUILD_TESTING is ON # -# e.g. `-DENABLE_SANITIZER_LEAK=ON` +# e.g. `-DENABLE_SANITIZER_LEAK=OFF` #### -option(ENABLE_SANITIZER_LEAK "Enable leak sanitizer" OFF) +option(ENABLE_SANITIZER_LEAK "Enable leak sanitizer" BUILD_TESTING) #### # `ENABLE_SANITIZER_UNDEFINED_BEHAVIOR:` @@ -230,11 +234,13 @@ option(ENABLE_SANITIZER_LEAK "Enable leak sanitizer" OFF) # # **Values:** # - ON: enables UndefinedBehaviorSanitizer. -# - OFF: (default) does not enable UndefinedBehaviorSanitizer. +# - OFF: does not enable UndefinedBehaviorSanitizer. +# +# Defaults to ON when BUILD_TESTING is ON # # e.g. `-DENABLE_SANITIZER_UNDEFINED_BEHAVIOR=ON` #### -option(ENABLE_SANITIZER_UNDEFINED_BEHAVIOR "Enable undefined behavior sanitizer" OFF) +option(ENABLE_SANITIZER_UNDEFINED_BEHAVIOR "Enable undefined behavior sanitizer" BUILD_TESTING) #### # `ENABLE_SANITIZER_THREAD:`