From 705c98d47937d603e3ad569cc2ade12fa1df3677 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Sun, 26 Jul 2026 22:13:52 +0200 Subject: build: add tsan build --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') 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("$<$:-fsanitize=undefined,address>") add_link_options("$<$:-fsanitize=undefined,address,leak>") + elseif(TEACHOS_ENABLE_TEST_TSAN) + add_compile_options("$<$:-fsanitize=thread;-g>") + add_link_options("$<$:-fsanitize=thread>") endif() endif() -- cgit v1.2.3