Fixed build script: set CLang compiler as sanitizer-enabled
authorkhizmax <libcds.dev@gmail.com>
Sun, 26 Feb 2017 16:20:07 +0000 (19:20 +0300)
committerkhizmax <libcds.dev@gmail.com>
Sun, 26 Feb 2017 16:20:07 +0000 (19:20 +0300)
CMakeLists.txt

index 159be55..80726f9 100644 (file)
@@ -48,7 +48,7 @@ if(WITH_BOOST_ATOMIC)
 endif(WITH_BOOST_ATOMIC)
 
 if(WITH_ASAN)
-    if(CMAKE_COMPILER_IS_GNUCXX)
+    if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O1 -fPIC -fsanitize=address -g -fno-omit-frame-pointer -fno-optimize-sibling-calls")
         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O1 -fsanitize=address -g -fno-omit-frame-pointer -fno-optimize-sibling-calls")
         set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address -pie")
@@ -58,7 +58,7 @@ if(WITH_ASAN)
 endif(WITH_ASAN)
 
 if(WITH_TSAN)
-    if(CMAKE_COMPILER_IS_GNUCXX)
+    if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O1 -fPIC -fsanitize=thread -g -DCDS_THREAD_SANITIZER_ENABLED -fno-omit-frame-pointer")
         set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -O1 -fPIC -fsanitize=thread -g -DCDS_THREAD_SANITIZER_ENABLED -fno-omit-frame-pointer")
         set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread -pie")