Changeset View
Changeset View
Standalone View
Standalone View
src/CMakeLists.txt
Show All 38 Lines | if(ENABLE_HARDENING) | ||||
# CMake provides the POSITION_INDEPENDENT_CODE property to set PIC/PIE. | # CMake provides the POSITION_INDEPENDENT_CODE property to set PIC/PIE. | ||||
# Unfortunately setting the -pie linker flag this way require CMake >= 3.14, | # Unfortunately setting the -pie linker flag this way require 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(-fPIE) | add_compiler_flag(-fPIE) | ||||
add_linker_flag(-pie) | add_linker_flag(-pie) | ||||
endif() | endif() | ||||
add_linker_flag(-Wl,-z,relro -Wl,-z,now) | |||||
endif() | endif() | ||||
# 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 | ||||
▲ Show 20 Lines • Show All 269 Lines • Show Last 20 Lines |