summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2020-02-12 10:56:13 +0100
committerStefan Metzmacher <metze@samba.org>2021-01-28 15:27:17 +0100
commit06e423d0647c4a3915f8600c8ec7c8825f8f1e97 (patch)
treee309b80e6a75f4b9b472248f37407f8ca83cdb5c
parenta9d93c078a80bb301df3f811da7442f6e99edc68 (diff)
downloadsocket_wrapper-06e423d0647c4a3915f8600c8ec7c8825f8f1e97.tar.gz
socket_wrapper-06e423d0647c4a3915f8600c8ec7c8825f8f1e97.tar.xz
socket_wrapper-06e423d0647c4a3915f8600c8ec7c8825f8f1e97.zip
cmake: Add ThreadSanitizer compile flags
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r--cmake/Modules/DefineCompilerFlags.cmake12
1 files changed, 12 insertions, 0 deletions
diff --git a/cmake/Modules/DefineCompilerFlags.cmake b/cmake/Modules/DefineCompilerFlags.cmake
index 3277b99..c92182d 100644
--- a/cmake/Modules/DefineCompilerFlags.cmake
+++ b/cmake/Modules/DefineCompilerFlags.cmake
@@ -34,4 +34,16 @@ if (UNIX AND NOT WIN32)
CACHE STRING "Flags used by the linker during the creation of shared libraries during UNDEFINEDSANITIZER builds.")
set(CMAKE_EXEC_LINKER_FLAGS_UNDEFINEDSANITIZER "-fsanitize=undefined"
CACHE STRING "Flags used by the linker during UNDEFINEDSANITIZER builds.")
+
+ # Activate with: -DCMAKE_BUILD_TYPE=ThreadSanitizer
+ set(CMAKE_C_FLAGS_THREADSANITIZER "-g -O1 -fsanitize=thread"
+ CACHE STRING "Flags used by the C compiler during THREADSANITIZER builds.")
+ set(CMAKE_CXX_FLAGS_THREADSANITIZER "-g -O1 -fsanitize=thread"
+ CACHE STRING "Flags used by the CXX compiler during THREADSANITIZER builds.")
+ set(CMAKE_SHARED_LINKER_FLAGS_THREADSANITIZER "-fsanitize=thread"
+ CACHE STRING "Flags used by the linker during the creation of shared libraries during THREADSANITIZER builds.")
+ set(CMAKE_MODULE_LINKER_FLAGS_THREADSANITIZER "-fsanitize=thread"
+ CACHE STRING "Flags used by the linker during the creation of shared libraries during THREADSANITIZER builds.")
+ set(CMAKE_EXEC_LINKER_FLAGS_THREADSANITIZER "-fsanitize=thread"
+ CACHE STRING "Flags used by the linker during THREADSANITIZER builds.")
endif()