From 9abcd0054c1cac66d3ea2c496a52fc184ff367a1 Mon Sep 17 00:00:00 2001 From: gorazd-sumkovski-arm <161028652+gorazd-sumkovski-arm@users.noreply.github.com> Date: Tue, 4 Nov 2025 16:44:31 +0000 Subject: [PATCH] Add ThreadSanitizer option (#2560) Add the `SANITIZER_THREAD` CMake option which will add the `-fsanitize=thread` flag to the compiler and linker when enabled. --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c0481ee..30a64447 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,12 @@ if(USE_CL_EXPERIMENTAL) add_definitions(-DCL_EXPERIMENTAL) endif(USE_CL_EXPERIMENTAL) +option(SANITIZER_THREAD "Build with the thread sanitiser" OFF) +if (SANITIZER_THREAD) + add_compile_options(-fsanitize=thread) + add_link_options(-fsanitize=thread) +endif (SANITIZER_THREAD) + #----------------------------------------------------------- # Default Configurable Test Set #-----------------------------------------------------------