aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt8
1 files changed, 7 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5f2ae141..8ac8dc04 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,7 @@ endif()
option(TEACHOS_ENABLE_LINTING "Enable linting during build" ON)
option(TEACHOS_GENERATE_DOCS "Generate documentation during build" ON)
option(TEACHOS_ENABLE_TEST_SANITIZERS "Enable sanitizers for test executables" ON)
+option(TEACHOS_ENABLE_TEST_TSAN "Enable TSan for the test executable" OFF)
#[============================================================================[
# Global Build System Configuration
@@ -107,9 +108,14 @@ if(BUILD_TESTING)
)
endif()
- if(TEACHOS_ENABLE_TEST_SANITIZERS)
+ if(TEACHOS_ENABLE_TEST_SANITIZERS AND TEACHOS_ENABLE_TEST_TSAN)
+ message(FATAL_ERROR "TEACHOS_ENABLE_TEST_SANITIZERS and TEACHOS_ENABLE_TEST_TSAN are mutually exclusive")
+ elseif(TEACHOS_ENABLE_TEST_SANITIZERS)
add_compile_options("$<$<CXX_COMPILER_ID:GNU>:-fsanitize=undefined,address>")
add_link_options("$<$<CXX_COMPILER_ID:GNU>:-fsanitize=undefined,address,leak>")
+ elseif(TEACHOS_ENABLE_TEST_TSAN)
+ add_compile_options("$<$<CXX_COMPILER_ID:GNU>:-fsanitize=thread;-g>")
+ add_link_options("$<$<CXX_COMPILER_ID:GNU>:-fsanitize=thread>")
endif()
endif()