From 37eb8b6efe1ed5ded8b62e58c4ae16b19a06e621 Mon Sep 17 00:00:00 2001 From: Username404 Date: Wed, 24 Mar 2021 11:47:51 +0100 Subject: [PATCH] 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. --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fdb977..9574dfc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)