Changeset View
Changeset View
Standalone View
Standalone View
src/CMakeLists.txt
Show All 32 Lines | |||||
# Unfortunately setting the -pie linker flag this way required CMake >= 3.14, | # Unfortunately setting the -pie linker flag this way required CMake >= 3.14, | ||||
# which is not widely distributed at the time of writing. | # which is not widely distributed at the time of writing. | ||||
# FIXME: use the POSITION_INDEPENDENT_CODE property instead | # FIXME: use the POSITION_INDEPENDENT_CODE property instead | ||||
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows") | if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows") | ||||
add_compiler_flag(-fPIC -fPIE) | add_compiler_flag(-fPIC -fPIE) | ||||
add_linker_flag(-pie) | add_linker_flag(-pie) | ||||
endif() | endif() | ||||
add_compiler_flag(-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2) | |||||
deadalnix: Please copy what autotool does for hardening instead. Passing the PIE flags is also part of the… | |||||
# Enable warning | # Enable warning | ||||
add_c_compiler_flag(-Wnested-externs -Wstrict-prototypes) | add_c_compiler_flag(-Wnested-externs -Wstrict-prototypes) | ||||
add_compiler_flag( | add_compiler_flag( | ||||
-Wall | -Wall | ||||
-Wextra | -Wextra | ||||
-Wformat | -Wformat | ||||
-Wvla | -Wvla | ||||
-Wformat-security | -Wformat-security | ||||
▲ Show 20 Lines • Show All 267 Lines • Show Last 20 Lines |
Please copy what autotool does for hardening instead. Passing the PIE flags is also part of the hardening featues.