Use CMAKE_CXX_EXTENSIONS instead of just CXX_EXTENSIONS in the CMakeLists.txt file, and also use CMAKE_POSITION_INDEPENDENT_CODE instead of the -fpie compilation flag.

This commit is contained in:
Username404 2021-03-24 11:47:51 +01:00
parent 1bfb46dd35
commit 37eb8b6efe
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 3 additions and 2 deletions

View File

@ -16,7 +16,7 @@ configure_file("resources/${PROJECT_NAME}.rc" "processed/${PROJECT_NAME}.rc" @ON
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CXX_EXTENSIONS OFF)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "-Wall")
if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
@ -27,8 +27,9 @@ if((${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) OR (${CMAKE_CXX_COMPILER_ID} STREQUAL
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0)
message(WARNING "A ${CMAKE_CXX_COMPILER_ID} compiler version of preferably 11 or higher should be used.")
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE True)
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc")
set(CMAKE_CXX_FLAGS "-flto ${CMAKE_CXX_FLAGS} -fpie -pipe -fstack-protector-strong -fstack-clash-protection")
set(CMAKE_CXX_FLAGS "-flto ${CMAKE_CXX_FLAGS} -pipe -fstack-protector-strong -fstack-clash-protection")
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-fcf-protection" CF_PROTECTION_SUPPORTED)
if (CF_PROTECTION_SUPPORTED)