]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
build: Enable _GLIBCXX_ASSERTIONS in debug build mode
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 22 May 2023 18:09:46 +0000 (20:09 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Mon, 22 May 2023 19:21:01 +0000 (21:21 +0200)
See also #1288.

CMakeLists.txt
cmake/StandardSettings.cmake

index a929775ed9a796ddc5fa16c11e3922d3e1c62785..b94ddcec5f4f8437837ffb85f54bbf111b15180f 100644 (file)
@@ -66,11 +66,11 @@ if(ENABLE_IPO AND NOT MINGW)
   set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
 endif()
 
+include(CIBuildType)
+include(DefaultBuildType)
 include(UseFastestLinker)
 include(StandardSettings)
 include(StandardWarnings)
-include(CIBuildType)
-include(DefaultBuildType)
 
 #
 # Configuration
index bee457c1aa5c6ca42b0cd55630d46ded126bcb03..b6a0643c99ac551869540487b685a64922235744 100644 (file)
@@ -13,6 +13,10 @@ else()
 endif()
 
 if(CMAKE_CXX_COMPILER_ID MATCHES "^GNU|(Apple)?Clang$" AND NOT MSVC)
+  if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+    target_compile_definitions(standard_settings INTERFACE _GLIBCXX_ASSERTIONS)
+  endif()
+
   option(ENABLE_COVERAGE "Enable coverage reporting for GCC/Clang" FALSE)
   if(ENABLE_COVERAGE)
     target_compile_options(standard_settings INTERFACE --coverage -O0 -g)