comparison CMakeLists.txt @ 37:00aa5fa3c2fb

Build System maintainance. Correct integration of Polarssl. Make profiling an option, fix static_check target
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 14 Mar 2014 09:01:19 +0000
parents bee7d274c4dc
children ad61489ce593
comparison
equal deleted inserted replaced
36:81183b721b51 37:00aa5fa3c2fb
1 cmake_minimum_required(VERSION 2.8.8) 1 cmake_minimum_required(VERSION 2.8.8)
2 project(m13) 2 project(m13)
3 3
4 option(DO_RELEASE_BUILD "Build for a public release." OFF) 4 option(DO_RELEASE_BUILD "Build for a public release." OFF)
5 option(ENABLE_PROFILING "Set to enable profiling." OFF)
5 6
6 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") 7 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
7 8
8 include(CTest) 9 include(CTest)
9 include(GenerateCppcheck) 10 include(GenerateCppcheck)
33 set(HARDENING_FLAGS " -Wall -Werror -fstack-protector-all -fno-exceptions") 34 set(HARDENING_FLAGS " -Wall -Werror -fstack-protector-all -fno-exceptions")
34 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wstack-protector") 35 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wstack-protector")
35 set(HARDENING_FLAGS " ${HARDENING_FLAGS} --param ssp-buffer-size=4") 36 set(HARDENING_FLAGS " ${HARDENING_FLAGS} --param ssp-buffer-size=4")
36 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -D_FORTIFY_SOURCE=2 -O0") 37 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -D_FORTIFY_SOURCE=2 -O0")
37 38
38 # Uncomment to enable profiling 39 if(ENABLE_PROFILING)
39 # set(PROFILING_FLAGS "-fprofile-arcs -ftest-coverage") 40 set(PROFILING_FLAGS "-fprofile-arcs -ftest-coverage")
40 # set(PROFILING_LIBS gcov) 41 set(PROFILING_LIBS gcov)
42 endif()
41 43
42 SET(CMAKE_EXE_LINKER_FLAGS=${PROFILING_FLAGS}) 44 SET(CMAKE_EXE_LINKER_FLAGS=${PROFILING_FLAGS})
43 45
44 if(UNIX) 46 if(UNIX)
45 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -pie -fPIE -ftrapv") 47 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -pie -fPIE -ftrapv")
48 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wl,--dynamicbase -Wl,--nxcompat") 50 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wl,--dynamicbase -Wl,--nxcompat")
49 endif() 51 endif()
50 52
51 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HARDENING_FLAGS}") 53 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HARDENING_FLAGS}")
52 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARN_HARDENING_FLAGS} ${HARDENING_FLAGS}") 54 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARN_HARDENING_FLAGS} ${HARDENING_FLAGS}")
55
56 add_custom_target(static_check)
53 57
54 # FlawFinder 58 # FlawFinder
55 find_program(FLAWFINDER_PATH flawfinder DOC "flawfinder path") 59 find_program(FLAWFINDER_PATH flawfinder DOC "flawfinder path")
56 if (FLAWFINDER_PATH) 60 if (FLAWFINDER_PATH)
57 add_custom_target(flawfinder COMMENT "FlawFinder" VERBATIM COMMAND ${FLAWFINDER_PATH} 61 add_custom_target(flawfinder COMMENT "FlawFinder" VERBATIM COMMAND ${FLAWFINDER_PATH}

http://wald.intevation.org/projects/trustbridge/