if(NOT Sanitizers_FIND_COMPONENTS)
set(Sanitizers_FIND_COMPONENTS
- address undefined-behavior)
+ address undefined_behavior)
endif()
if(HAVE_JEMALLOC)
message(WARNING "JeMalloc does not work well with sanitizers")
foreach(component ${Sanitizers_FIND_COMPONENTS})
if(component STREQUAL "address")
- set(Sanitizers_Address_COMPILE_OPTIONS "address")
- list(APPEND Sanitizers_OPTIONS "address")
+ set(Sanitizers_address_COMPILE_OPTIONS "address")
elseif(component STREQUAL "leak")
- set(Sanitizers_Leak_COMPILE_OPTIONS "leak")
- list(APPEND Sanitizers_OPTIONS "leak")
+ set(Sanitizers_leak_COMPILE_OPTIONS "leak")
elseif(component STREQUAL "thread")
- if ("Address" IN_LIST ${Sanitizers_FIND_COMPONENTS} OR
- "Leak" IN_LIST ${Sanitizers_FIND_COMPONENTS})
+ if ("address" IN_LIST ${Sanitizers_FIND_COMPONENTS} OR
+ "leak" IN_LIST ${Sanitizers_FIND_COMPONENTS})
message(SEND_ERROR "Cannot combine -fsanitize-leak w/ -fsanitize-thread")
elseif(NOT CMAKE_POSITION_INDEPENDENT_CODE)
message(SEND_ERROR "TSan requires all code to be position independent")
endif()
set(Sanitizers_Thread_COMPILE_OPTIONS "thread")
- list(APPEND Sanitizers_OPTIONS "thread")
- elseif(component STREQUAL "undefined-behavior")
- set(Sanitizers_Undefined-Behavior_COMPILE_OPTIONS "undefined")
- list(APPEND Sanitizers_OPTIONS "undefined")
+ elseif(component STREQUAL "undefined_behavior")
+ set(Sanitizers_undefined_behavior_COMPILE_OPTIONS "undefined")
else()
message(SEND_ERROR "Unsupported sanitizer: ${component}")
endif()
+ list(APPEND Sanitizers_OPTIONS "${Sanitizers_${component}_COMPILE_OPTIONS}")
endforeach()
if(Sanitizers_OPTIONS)