Check if MemorySanitizer is used on x86_64 Linux.

According to the MemorySanitizer documentation, it is only compatible with 64bit
Linux at the moment.
This commit is contained in:
Alexander Haase 2016-04-06 19:32:45 +02:00
parent 4d96db375f
commit de1a134183

View File

@ -31,10 +31,25 @@ set(FLAG_CANDIDATES
include(sanitize-helpers) include(sanitize-helpers)
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "MemorySanitizer" "MSan") if (SANITIZE_MEMORY)
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
message(WARNING "MemorySanitizer disabled for target ${TARGET} because "
"MemorySanitizer is supported for Linux systems only.")
set(SANITIZE_MEMORY Off CACHE BOOL
"Enable MemorySanitizer for sanitized targets." FORCE)
elseif (NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
message(WARNING "MemorySanitizer disabled for target ${TARGET} because "
"MemorySanitizer is supported for 64bit systems only.")
set(SANITIZE_MEMORY Off CACHE BOOL
"Enable MemorySanitizer for sanitized targets." FORCE)
else ()
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "MemorySanitizer"
"MSan")
endif ()
endif ()
function (add_sanitize_memory TARGET) function (add_sanitize_memory TARGET)
if (NOT SANITIZE_THREAD) if (NOT SANITIZE_MEMORY)
return() return()
endif () endif ()