diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-07-26 22:13:52 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-07-26 22:13:52 +0200 |
| commit | 705c98d47937d603e3ad569cc2ade12fa1df3677 (patch) | |
| tree | 6cd980e01943a87126ec51a248ffc4f03a195e5f /CMakeLists.txt | |
| parent | 4b28e4626e744ac9b779a680f8e9647014956dda (diff) | |
| download | kernel-705c98d47937d603e3ad569cc2ade12fa1df3677.tar.xz kernel-705c98d47937d603e3ad569cc2ade12fa1df3677.zip | |
build: add tsan build
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 8 |
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() |
