From 089a5f5ab2aa6db787427428d709f525277c97bc Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Fri, 7 Jul 2023 16:32:42 -0400 Subject: [PATCH] [cmake] Include build options for TSAN and MSAN --- c++/app4triqs/CMakeLists.txt | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/c++/app4triqs/CMakeLists.txt b/c++/app4triqs/CMakeLists.txt index b9f32c96..12ea5998 100644 --- a/c++/app4triqs/CMakeLists.txt +++ b/c++/app4triqs/CMakeLists.txt @@ -49,7 +49,7 @@ if(ANALYZE_SOURCES) TARGET ${PROJECT_NAME}_c COMMAND ${CPPCHECK_EXECUTABLE} --enable=warning,style,performance,portability - --std=c++20 + --std=c++23 --template=gcc --verbose --force @@ -64,21 +64,28 @@ if(ANALYZE_SOURCES) endif() - # ========= Dynamic Analyzer Checks ========== option(ASAN OFF "Compile library and executables with LLVM Address Sanitizer") -option(UBSAN OFF "Compile library and executables with LLVM Undefined Behavior Sanitizer") - if(ASAN) - if(NOT TARGET asan) - find_package(sanitizer REQUIRED "asan") - endif() + find_package(sanitizer REQUIRED COMPONENTS asan) target_link_libraries(${PROJECT_NAME}_c PUBLIC $) endif() + +option(UBSAN OFF "Compile library and executables with LLVM Undefined Behavior Sanitizer") if(UBSAN) - if(NOT TARGET ubsan) - find_package(sanitizer REQUIRED "ubsan") - endif() + find_package(sanitizer REQUIRED COMPONENTS ubsan) target_link_libraries(${PROJECT_NAME}_c PUBLIC $) endif() + +option(MSAN OFF "Compile library and executables with LLVM Memory Sanitizer") +if(MSAN) + find_package(sanitizer REQUIRED COMPONENTS msan) + target_link_libraries(${PROJECT_NAME}_c PUBLIC $) +endif() + +option(TSAN OFF "Compile library and executables with LLVM Thread Sanitizer") +if(TSAN) + find_package(sanitizer REQUIRED COMPONENTS tsan) + target_link_libraries(${PROJECT_NAME}_c PUBLIC $) +endif()