Add ThreadSanitizer option (#2560)

Add the `SANITIZER_THREAD` CMake option which will add the
`-fsanitize=thread` flag to the compiler and linker when enabled.
This commit is contained in:
gorazd-sumkovski-arm 2025-11-04 16:44:31 +00:00 committed by GitHub
parent 941f7edb95
commit 9abcd0054c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
#-----------------------------------------------------------