Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 41a9cf55 authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

Add block to define compilation flags

parent 97fdacc3
No related branches found
No related tags found
1 merge request!5Hotfix/updates from pastix
...@@ -33,6 +33,29 @@ if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) ...@@ -33,6 +33,29 @@ if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
enable_testing() enable_testing()
include(CTest) include(CTest)
include (CheckCCompilerFlag)
# Set warnings for debug builds
check_c_compiler_flag( "-Wall" HAVE_WALL )
if( HAVE_WALL )
set( C_WFLAGS "${C_WFLAGS} -Wall" )
endif( HAVE_WALL )
check_c_compiler_flag( "-Wextra" HAVE_WEXTRA )
if( HAVE_WEXTRA )
set( C_WFLAGS "${C_WFLAGS} -Wextra" )
endif( HAVE_WEXTRA )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_WFLAGS}" )
# add gdb symbols in debug and relwithdebinfo
check_c_compiler_flag( "-g3" HAVE_G3 )
if( HAVE_G3 )
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g3" )
set( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -g3" )
else()
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0" )
endif( HAVE_G3 )
else() else()
set( BUILD_AS_SUBPROJECT ON ) set( BUILD_AS_SUBPROJECT ON )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment