From: Joel Rosdahl Date: Mon, 22 May 2023 18:09:46 +0000 (+0200) Subject: build: Enable _GLIBCXX_ASSERTIONS in debug build mode X-Git-Tag: v4.8.2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26c9d522de6941005f612ef3811a7b46ac8beb2c;p=thirdparty%2Fccache.git build: Enable _GLIBCXX_ASSERTIONS in debug build mode See also #1288. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index a929775ed..b94ddcec5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/cmake/StandardSettings.cmake b/cmake/StandardSettings.cmake index bee457c1a..b6a0643c9 100644 --- a/cmake/StandardSettings.cmake +++ b/cmake/StandardSettings.cmake @@ -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)