adds TSAN/ASAN buid settings

This commit is contained in:
2025-11-09 20:19:54 +01:00
parent 687c544ccb
commit bd032c08ce
14 changed files with 48 additions and 22 deletions

View File

@@ -7,6 +7,9 @@ project(SCC_Test)
option(FULL_TEST_SUITE "enable also long-running tests" OFF)
option(ENABLE_SCV "Enable use of SCV" OFF)
option(ENABLE_CLANG_TIDY "Enable clang-tidy checks" OFF)
option(ENABLE_CLANG_FORMAT "Enable clang-format targets" OFF)
option(THREAD_SANITIZER "Enable thread sanitizer TSan" OFF)
option(ADDR_SANITIZER "Enable address sanitizer ASan" OFF)
include(GNUInstallDirs)
include(BuildType)
@@ -30,7 +33,15 @@ if(ENABLE_COVERAGE)
include(CodeCoverage)
append_coverage_compiler_flags()
endif()
if (THREAD_SANITIZER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -O0 -g")
elseif(ADDR_SANITIZER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -O0 -g")
else()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
endif()
if(ENABLE_CLANG_TIDY)
find_program(CLANG_TIDY_EXE NAMES "clang-tidy")
if(CLANG_TIDY_EXE)
@@ -44,7 +55,9 @@ if(ENABLE_CLANG_TIDY)
endif()
set(CLANG_FORMAT_EXCLUDE_PATTERNS "/third_party/" "/build/")
find_package(ClangFormat)
if(ENABLE_CLANG_FORMAT)
find_package(ClangFormat)
endif()
find_package(ZLIB)
find_package(lz4)
# This line finds the boost lib and headers.
@@ -57,7 +70,6 @@ find_package(Catch2)
include(SystemCPackage)
include(CTest)
include(Catch)
enable_testing()
set(WITH_SCP4SCC ON)
add_subdirectory(scc)