diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ac8a0c6..8e84ba8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,6 +68,18 @@ if(ACL_CODE_COVERAGE) endif() endif() +# Flag for tsan scans +option(ACL_TSAN "Build with tsan" OFF) +message(STATUS "Build with tsan: ${ACL_TSAN}") +if(ACL_TSAN) + if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -fno-omit-frame-pointer") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread -fno-omit-frame-pointer") + else() + message(FATAL_ERROR "cannot build with tsan tools due to unsupported CXX compiler") + endif() +endif() + ################################################################################ ### Modified Debug flags ################################################################################