Permalink
Browse files

add debug option for debug builds

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: José Fonseca <jose.r.fonseca@gmail.com>
  • Loading branch information...
1 parent 5f2245e commit 33b9a0fb1189e9fb3c0cb9abfb8c4ea5946a19a9 @ideak ideak committed with jrfonseca Apr 20, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 CMakeLists.txt
View
10 CMakeLists.txt
@@ -117,6 +117,16 @@ else ()
add_definitions (-Wall)
# XXX: it's safer to use ssize_t everywhere instead of disabling warning
add_definitions (-Wno-sign-compare) # comparison between signed and unsigned integer expressions
+
+ # Use GDB extensions if available
+ if (CMAKE_COMPILER_IS_GNUC)
+ set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -O0")
+ set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ggdb")
+ endif ()
+ if (CMAKE_COMPILER_IS_GNUCXX)
+ set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb -O0")
+ set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ggdb")
+ endif ()
endif ()
if (MINGW)

0 comments on commit 33b9a0f

Please sign in to comment.