Changeset View
Changeset View
Standalone View
Standalone View
src/CMakeLists.txt
Show All 18 Lines | |||||
# Ensure that WINDRES_PREPROC is enabled when using windres. | # Ensure that WINDRES_PREPROC is enabled when using windres. | ||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") | if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") | ||||
list(APPEND CMAKE_RC_FLAGS "-DWINDRES_PREPROC") | list(APPEND CMAKE_RC_FLAGS "-DWINDRES_PREPROC") | ||||
endif() | endif() | ||||
# Enable warning | # Enable warning | ||||
include(AddCompilerFlags) | include(AddCompilerFlags) | ||||
# CMake provides the POSITION_INDEPENDENT_CODE property to set PIC/PIE. | |||||
# Unfortunately setting the -pie linker flag this way required CMake >= 3.14, | |||||
# which is not widely distributed at the time of writing. | |||||
# FIXME: use the POSITION_INDEPENDENT_CODE property instead | |||||
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows") | |||||
add_compiler_flag(-fPIC -fPIE) | |||||
add_linker_flag(-pie) | |||||
endif() | |||||
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 | ||||
-Wcast-align | -Wcast-align | ||||
▲ Show 20 Lines • Show All 265 Lines • Show Last 20 Lines |