Changeset View
Changeset View
Standalone View
Standalone View
src/CMakeLists.txt
Show First 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | if(ENABLE_HARDENING) | ||||
# Make the relocated sections read-only | # Make the relocated sections read-only | ||||
add_linker_flags(-Wl,-z,relro -Wl,-z,now) | add_linker_flags(-Wl,-z,relro -Wl,-z,now) | ||||
# 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 | ||||
add_compiler_flags(-fPIE) | if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows") | ||||
add_linker_flags(-pie) | add_compiler_flag(-fPIE) | ||||
add_linker_flag(-pie) | |||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") | else() | ||||
# MinGw provides its own libssp for stack smashing protection | # MinGw provides its own libssp for stack smashing protection | ||||
link_libraries(ssp) | link_libraries(ssp) | ||||
endif() | endif() | ||||
endif() | endif() | ||||
# Enable warning | # Enable warning | ||||
add_c_compiler_flags(-Wnested-externs -Wstrict-prototypes) | add_c_compiler_flags(-Wnested-externs -Wstrict-prototypes) | ||||
add_compiler_flags( | add_compiler_flags( | ||||
▲ Show 20 Lines • Show All 337 Lines • Show Last 20 Lines |