Merge pull request #23567 from tchaikov/wip-cmake-cleanup

cmake: fix Debug build `WITH_SEASTAR=ON`

Reviewed-by: Casey Bodley <cbodley@redhat.com>
Reviewed-by: Willem Jan Withagen <wjw@digiware.nl>
This commit is contained in:
Kefu Chai 2018-08-21 21:30:46 +08:00 committed by GitHub
commit 0d209b6c21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
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")
@ -10,26 +10,23 @@ set(Sanitizers_OPTIONS)
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)