summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorHans Kristian Rosbach <hk-git@circlestorm.org>2021-06-13 15:11:23 +0200
committerHans Kristian Rosbach <hk-git@circlestorm.org>2021-06-21 11:18:23 +0200
commit89992dfbf11c3665f9c7808237a9ba865beb82f2 (patch)
tree65fba55a6cc0fa0f0e6a5ba083bd10c69bbad4cf /cmake
parent6cc263766674a9f64161de2bb2dfe725a0d78c2a (diff)
Change WITH_SANITIZER to be a multi-option parameter (for ccmake etc).
Add support for selcting Thread sanitizer.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/detect-sanitizer.cmake12
1 files changed, 11 insertions, 1 deletions
diff --git a/cmake/detect-sanitizer.cmake b/cmake/detect-sanitizer.cmake
index 172a8d5..b0a0236 100644
--- a/cmake/detect-sanitizer.cmake
+++ b/cmake/detect-sanitizer.cmake
@@ -69,6 +69,16 @@ macro(add_memory_sanitizer)
endif()
endmacro()
+macro(add_thread_sanitizer)
+ check_sanitizer_support("thread" supported_checks)
+ if(NOT ${supported_checks} STREQUAL "")
+ message(STATUS "Thread sanitizer is enabled: ${supported_checks}")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${supported_checks}")
+ else()
+ message(STATUS "Thread sanitizer is not supported")
+ endif()
+endmacro()
+
macro(add_undefined_sanitizer)
set(known_checks
array-bounds
@@ -120,4 +130,4 @@ macro(add_undefined_sanitizer)
else()
message(STATUS "UNdefined behavior sanitizer is not supported")
endif()
-endmacro() \ No newline at end of file
+endmacro()