comparison CMakeLists.txt @ 1142:148014db2f3b static-libc

(issue126) Commit WIP on static linking libc
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 18 Sep 2014 10:29:38 +0200
parents 6950f08342bb
children
comparison
equal deleted inserted replaced
1136:e82c440c2727 1142:148014db2f3b
84 84
85 # Warn level to be used for privileged parts 85 # Warn level to be used for privileged parts
86 set(WARN_HARDENING_FLAGS " -Wextra -Wconversion -Wformat-security") 86 set(WARN_HARDENING_FLAGS " -Wextra -Wconversion -Wformat-security")
87 87
88 # Hardening flags 88 # Hardening flags
89 set(HARDENING_FLAGS " -Wall -fstack-protector-all -fno-exceptions") 89 set(HARDENING_FLAGS " -fPIC -Wall -fstack-protector-all -fno-exceptions")
90 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wstack-protector") 90 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wstack-protector")
91 set(HARDENING_FLAGS " ${HARDENING_FLAGS} --param ssp-buffer-size=4") 91 set(HARDENING_FLAGS " ${HARDENING_FLAGS} --param ssp-buffer-size=4")
92 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -D_FORTIFY_SOURCE=2 -O0") 92 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -D_FORTIFY_SOURCE=2 -O0")
93 93
94 if(ENABLE_PROFILING) 94 if(ENABLE_PROFILING)
101 add_definitions(-DWINVER=0x0600) 101 add_definitions(-DWINVER=0x0600)
102 add_definitions(-DMINGW_HAS_SECURE_API) # for _s functions 102 add_definitions(-DMINGW_HAS_SECURE_API) # for _s functions
103 endif(WIN32) 103 endif(WIN32)
104 104
105 if(UNIX) 105 if(UNIX)
106 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -pie -fPIE -ftrapv") 106 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Bdynamic -ftrapv")
107 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wl,-z,relro,-z,now") 107 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wl,-z,relro,-z,now")
108 set(EXTRA_STATIC_FLAGS " -Wl,--undefined=__pthread_unwind -static -static-libstdc++ -static-libgcc")
108 elseif(WIN32) 109 elseif(WIN32)
109 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wl,--dynamicbase -Wl,--nxcompat") 110 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wl,--dynamicbase -Wl,--nxcompat")
110 endif() 111 endif()
111 112
112 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HARDENING_FLAGS} ${PROFILING_FLAGS}") 113 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HARDENING_FLAGS} ${PROFILING_FLAGS}")

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