]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: should use lowercase for component name in FindSanitizers.cmake 23567/head
authorKefu Chai <kchai@redhat.com>
Sat, 11 Aug 2018 04:30:31 +0000 (12:30 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 21 Aug 2018 12:05:49 +0000 (20:05 +0800)
and s/undefined-behavior/undefined_behavior/ to be compatible with
seastar

Signed-off-by: Kefu Chai <kchai@redhat.com>
cmake/modules/FindSanitizers.cmake

index 31f1ed3d4aa2d8c61982d49cc1a91a475cd89e06..648edc67f50667c0d477ad302be87a09c8013275 100644 (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)