From cf4fbc86ba50989f27c197d8dc556292f41414dd Mon Sep 17 00:00:00 2001 From: Peter De Wachter Date: Fri, 26 Jan 2018 22:13:59 +0100 Subject: [PATCH] CMake: enable assert() for all build types --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b1066a..15f430c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,17 @@ include(CheckCXXCompilerFlag) include(CheckIncludeFileCXX) +## Enable assertions for all builds +## (cmake by default sets NDEBUG for release builds) + +foreach(var + CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS_MINSIZEREL) + string(REGEX REPLACE "(^| )[/-]D *NDEBUG($| )" " " "${var}" "${${var}}") +endforeach() + + ## Configure the compiler set(CMAKE_CXX_STANDARD 11)