From dda006a0079d140dc20d4b0cd60db196bfe3893a Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 11 Aug 2018 12:30:31 +0800 Subject: [PATCH] cmake: should use lowercase for component name in FindSanitizers.cmake and s/undefined-behavior/undefined_behavior/ to be compatible with seastar Signed-off-by: Kefu Chai --- cmake/modules/FindSanitizers.cmake | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/cmake/modules/FindSanitizers.cmake b/cmake/modules/FindSanitizers.cmake index 31f1ed3d4aa2d..648edc67f5066 100644 --- a/cmake/modules/FindSanitizers.cmake +++ b/cmake/modules/FindSanitizers.cmake @@ -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) -- 2.39.5