aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-07-26 22:13:52 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-07-26 22:13:52 +0200
commit705c98d47937d603e3ad569cc2ade12fa1df3677 (patch)
tree6cd980e01943a87126ec51a248ffc4f03a195e5f /CMakeLists.txt
parent4b28e4626e744ac9b779a680f8e9647014956dda (diff)
downloadkernel-705c98d47937d603e3ad569cc2ade12fa1df3677.tar.xz
kernel-705c98d47937d603e3ad569cc2ade12fa1df3677.zip
build: add tsan build
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()