From a8600a598bcdbb66274bb45219b5fb02ad16758b Mon Sep 17 00:00:00 2001 From: o9000 Date: Wed, 18 Mar 2015 19:54:48 +0000 Subject: [PATCH] Add some useful compiler flags for debug builds git-svn-id: http://tint2.googlecode.com/svn/trunk@728 121b4492-b84c-0410-8b4c-0d4edfb3f3cc --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 492a966..afc797a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,14 @@ if( ENABLE_TINT2CONF ) add_dependencies( tint2conf version ) endif( ENABLE_TINT2CONF ) +if( CMAKE_BUILD_TYPE MATCHES Debug) + SET(DBG_C_FLAGS " -O0 -g3 -gdwarf-2 -fsanitize=address -fno-common -fno-omit-frame-pointer -rdynamic ") + SET(DBG_L_FLAGS " -O0 -g3 -gdwarf-2 -fsanitize=address -fno-common -fno-omit-frame-pointer -rdynamic ") +else() + SET(DBG_C_FLAGS "") + SET(DBG_L_FLAGS "") +endif() + set( MANDIR share/man CACHE PATH "Directory for man pages" ) set( DATADIR share CACHE PATH "Directory for shared data" ) set( SYSCONFDIR /etc CACHE PATH "Directory for configuration files" ) @@ -131,8 +139,8 @@ endif( RT_LIBRARY ) target_link_libraries( tint2 m ) add_dependencies( tint2 version ) -set_target_properties( tint2 PROPERTIES COMPILE_FLAGS "-Wall -pthread" ) -set_target_properties( tint2 PROPERTIES LINK_FLAGS "-pthread" ) +set_target_properties( tint2 PROPERTIES COMPILE_FLAGS "-Wall -pthread ${DBG_C_FLAGS}" ) +set_target_properties( tint2 PROPERTIES LINK_FLAGS "-pthread ${DBG_L_FLAGS}" ) install( TARGETS tint2 DESTINATION bin ) install( FILES sample/tint2rc DESTINATION ${SYSCONFDIR}/xdg/tint2 )