Make ASAN optional in debug builds

git-svn-id: http://tint2.googlecode.com/svn/trunk@759 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
o9000 2015-04-17 20:23:07 +00:00 committed by mrovi9000@gmail.com
parent 66cae4bb7c
commit eef4987b0b

View file

@ -6,6 +6,7 @@ option( ENABLE_TINT2CONF "Enable tint2conf build, a GTK+2 theme configurator for
option( ENABLE_EXAMPLES "Install additional tin2rc examples" OFF )
option( ENABLE_RSVG "Rsvg support (launcher only)" ON )
option( ENABLE_SN "Startup notification support" ON )
option( ENABLE_ASAN "Build tint2 with AddressSanitizer" OFF )
include( FindPkgConfig )
include( CheckLibraryExists )
@ -99,12 +100,12 @@ 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 ")
if( ENABLE_ASAN )
SET(ASAN_C_FLAGS " -O0 -g3 -gdwarf-2 -fsanitize=address -fno-common -fno-omit-frame-pointer -rdynamic ")
SET(ASAN_L_FLAGS " -O0 -g3 -gdwarf-2 -fsanitize=address -fno-common -fno-omit-frame-pointer -rdynamic ")
else()
SET(DBG_C_FLAGS "")
SET(DBG_L_FLAGS "")
SET(ASAN_C_FLAGS "")
SET(ASAN_L_FLAGS "")
endif()
set( MANDIR share/man CACHE PATH "Directory for man pages" )
@ -140,8 +141,8 @@ endif( RT_LIBRARY )
target_link_libraries( tint2 m )
add_dependencies( tint2 version )
set_target_properties( tint2 PROPERTIES COMPILE_FLAGS "-Wall -fno-strict-aliasing -pthread ${DBG_C_FLAGS}" )
set_target_properties( tint2 PROPERTIES LINK_FLAGS "-pthread -fno-strict-aliasing ${DBG_L_FLAGS}" )
set_target_properties( tint2 PROPERTIES COMPILE_FLAGS "-Wall -fno-strict-aliasing -pthread ${ASAN_C_FLAGS}" )
set_target_properties( tint2 PROPERTIES LINK_FLAGS "-pthread -fno-strict-aliasing ${ASAN_L_FLAGS}" )
install( TARGETS tint2 DESTINATION bin )
install( FILES sample/tint2rc DESTINATION ${SYSCONFDIR}/xdg/tint2 )