]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
src/CMakeLists.txt: enable _GLIBCXX_ASSERTIONS in debug builds
authorSamuel Just <sjust@redhat.com>
Thu, 19 Dec 2019 00:05:14 +0000 (00:05 +0000)
committerSamuel Just <sjust@redhat.com>
Thu, 23 Jan 2020 00:03:06 +0000 (16:03 -0800)
We already enable this by default in our rpm builds.  Adding it here as
well increases the odds we'll catch things with make check and local
testing.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/CMakeLists.txt

index bb22331d38e1b6ef100fe01de1064c934d834654..a1a82845cb4b6eec227369dd6ef4bb68a274c8e9 100644 (file)
@@ -108,6 +108,11 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
   endif()
 endif(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
 
+CHECK_C_COMPILER_FLAG("-D_GLIBCXX_ASSERTIONS" HAS_GLIBCXX_ASSERTIONS)
+if(HAS_GLIBCXX_ASSERTIONS AND CMAKE_BUILD_TYPE STREQUAL Debug)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_ASSERTIONS")
+endif()
+
 include(SIMDExt)
 if(HAVE_INTEL)
   set(CMAKE_ASM_COMPILER  ${PROJECT_SOURCE_DIR}/src/yasm-wrapper)