]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
Merge pull request #9975 from ceph/wip-cmake
authorAli Maredia <amaredia@redhat.com>
Tue, 28 Jun 2016 18:46:26 +0000 (14:46 -0400)
committerGitHub <noreply@github.com>
Tue, 28 Jun 2016 18:46:26 +0000 (14:46 -0400)
cmake changes

Reviewed-by: Ali Maredia <amaredia@redhat.com>
1  2 
src/CMakeLists.txt

index 0bda6635f73862f0520e9e37009fdcba1c25feb0,641fdb83a3a8327d140b8972537aed0431469495..9ff15d92d0fd969b735fd6b7d0c7d326364c975c
@@@ -25,9 -25,18 +25,19 @@@ if(NOT CMAKE_BUILD_TYPE
    set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Default BUILD_TYPE is RelWithDebInfo, other options are: Debug, Release, and MinSizeRel." FORCE) 
  endif()
  
+ if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
+   # we use assert(3) for testing, so scrub the -DNDEBUG defined by default
+   string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type_upper)
+   foreach(flags
+       CMAKE_CXX_FLAGS_${build_type_upper}
+       CMAKE_C_FLAGS_${build_type_upper})
+     string(REGEX REPLACE "(^| )[/-]D *NDEBUG($| )" " " "${flags}" "${${flags}}")
+   endforeach()
+ endif()
  include(CheckCCompilerFlag)
 -CHECK_C_COMPILER_FLAG("-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2 -Werror" HAS_FORTIFY_SOURCE)
 +CHECK_C_COMPILER_FLAG("-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2" HAS_FORTIFY_SOURCE)
 +if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
  if(HAS_FORTIFY_SOURCE)
    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=2")
  endif()