Remove some errors and add TODO for MemorySanitizer.
@@ -64,6 +64,11 @@ if(OPTION_BUILD_THREAD_SANITIZER AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE
set(DEFAULT_LIBRARIES -ltsan)
set(TESTS_SANITIZER_ENVIRONMENT_VARIABLES)
set(SANITIZER_COMPILE_DEFINITIONS)
+elseif(OPTION_BUILD_MEMORY_SANITIZER AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
+ # TODO: This requires much more effort than expected: https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo
+ set(DEFAULT_LIBRARIES)
+ set(TESTS_SANITIZER_ENVIRONMENT_VARIABLES)
+ set(SANITIZER_COMPILE_DEFINITIONS)
elseif(OPTION_BUILD_SANITIZER AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
set(DEFAULT_LIBRARIES -lasan -lubsan)
set(TESTS_SANITIZER_ENVIRONMENT_VARIABLES
@@ -214,7 +219,6 @@ if (PROJECT_OS_FAMILY MATCHES "unix")
# Sanitizers
if(OPTION_BUILD_THREAD_SANITIZER AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
- add_compile_options(-fuse-ld=gold)
add_compile_options(-fno-omit-frame-pointer)
add_compile_options(-fno-optimize-sibling-calls)
add_compile_options(-fsanitize=thread)
@@ -227,13 +231,11 @@ if (PROJECT_OS_FAMILY MATCHES "unix")
add_compile_options(-fsanitize=leak)
add_compile_options(-fsanitize-address-use-after-scope)
elseif(OPTION_BUILD_MEMORY_SANITIZER AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
- add_compile_options(-fuse-ld=gold)
add_compile_options(-fno-omit-frame-pointer)
add_compile_options(-fno-optimize-sibling-calls)
add_compile_options(-fsanitize=undefined)
- add_compile_options(-fsanitize-address-use-after-scope)
add_compile_options(-fsanitize=memory)
- add_compile_options(-fsanitize=memory-track-origins)
+ add_compile_options(-fsanitize-memory-track-origins)
add_compile_options(-fsanitize-memory-use-after-dtor)
endif()
endif()
