1 From f3b176f27268e13942f452e915171b9c8b34f6ce Mon Sep 17 00:00:00 2001
2 From: Antonio Ospite <ospite@studenti.unina.it>
3 Date: Wed, 30 Oct 2013 10:41:06 +0100
4 Subject: [PATCH] CMakeLists.txt: define DEBUG=1 only when
6 X-Face: z*RaLf`X<@C75u6Ig9}{oW$H;1_\2t5)({*|jhM<pyWR#k60!#=#>/Vb;]yA5<GWI5`6u&+
7 ;6b'@y|8w"wB;4/e!7wYYrcqdJFY,~%Gk_4]cq$Ei/7<j&N3ah(m`ku?pX.&+~:_/wC~dwn^)MizBG
8 !pE^+iDQQ1yC6^,)YDKkxDd!T>\I~93>J<_`<4)A{':UrE
10 When building with CMAKE_BUILD_TYPE=RelWithDebInfo the development debug
11 code should not be enabled, so don't define DEBUG=1 in DEBUG_FLAGS as
12 this will end up being both in CMAKE_C_FLAGS_DEBUG and
13 CMAKE_C_FLAGS_RELWITHDEBINFO.
15 Instead define DEBUG=1 only for CMAKE_C_FLAGS_DEBUG so it gets used only
16 when CMAKE_BUILD_TYPE=Debug.
18 CMakeLists.txt | 5 ++---
19 1 file changed, 2 insertions(+), 3 deletions(-)
21 diff --git a/CMakeLists.txt b/CMakeLists.txt
22 index d643ed9..fa111c9 100644
25 @@ -69,8 +69,7 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
33 add_flags(RELEASE_FLAGS
34 -Wp,-D_FORTIFY_SOURCE=2)
35 @@ -105,7 +104,7 @@ if (CMAKE_COMPILER_IS_CLANG)
39 -set(CMAKE_C_FLAGS_DEBUG "-O0 ${DEBUG_FLAGS} ${STRICT_FLAGS}")
40 +set(CMAKE_C_FLAGS_DEBUG "-O0 -DDEBUG=1 ${DEBUG_FLAGS} ${STRICT_FLAGS}")
41 set(CMAKE_C_FLAGS_RELEASE "-O2 ${RELEASE_FLAGS} ${STRICT_FLAGS}")
42 set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 ${RELEASE_FLAGS} ${DEBUG_FLAGS} ${STRICT_FLAGS}")