From: Antonio Ospite Date: Wed, 30 Oct 2013 09:41:06 +0000 (+0100) Subject: CMakeLists.txt: define DEBUG=1 only when CMAKE_BUILD_TYPE=Debug X-Git-Tag: v0.1.5~15 X-Git-Url: https://git.ao2.it/libam7xxx.git/commitdiff_plain/f3b176f27268e13942f452e915171b9c8b34f6ce?ds=inline CMakeLists.txt: define DEBUG=1 only when CMAKE_BUILD_TYPE=Debug When building with CMAKE_BUILD_TYPE=RelWithDebInfo the development debug code should not be enabled, so don't define DEBUG=1 in DEBUG_FLAGS as this will end up being both in CMAKE_C_FLAGS_DEBUG and CMAKE_C_FLAGS_RELWITHDEBINFO. Instead define DEBUG=1 only for CMAKE_C_FLAGS_DEBUG so it gets used only when CMAKE_BUILD_TYPE=Debug. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index d643ed9..fa111c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,8 +69,7 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) -fstack-protector) add_flags(DEBUG_FLAGS - -ggdb - -DDEBUG=1) + -ggdb) add_flags(RELEASE_FLAGS -Wp,-D_FORTIFY_SOURCE=2) @@ -105,7 +104,7 @@ if (CMAKE_COMPILER_IS_CLANG) endif() endif() -set(CMAKE_C_FLAGS_DEBUG "-O0 ${DEBUG_FLAGS} ${STRICT_FLAGS}") +set(CMAKE_C_FLAGS_DEBUG "-O0 -DDEBUG=1 ${DEBUG_FLAGS} ${STRICT_FLAGS}") set(CMAKE_C_FLAGS_RELEASE "-O2 ${RELEASE_FLAGS} ${STRICT_FLAGS}") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 ${RELEASE_FLAGS} ${DEBUG_FLAGS} ${STRICT_FLAGS}")