Add even more flags for the GNU and Clang compilers...

This commit is contained in:
Username404 2021-08-10 10:58:18 +02:00
parent 8739623a08
commit 41da4ef6ac
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 2 additions and 2 deletions

View File

@ -39,7 +39,7 @@ endif()
if ((${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) OR (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang))
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc")
set(CMAKE_CXX_FLAGS "-flto ${CMAKE_CXX_FLAGS} -pipe -fstack-protector-strong -fstack-clash-protection")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fmerge-all-constants -ftree-vectorize")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffunction-sections -fdata-sections -fmerge-all-constants -ftree-vectorize")
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-fcf-protection" CF_PROTECTION_SUPPORTED)
if (CF_PROTECTION_SUPPORTED)
@ -51,7 +51,7 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${MINIMAL_GNU})
message(FATAL_ERROR "G++ ${MINIMAL_GNU} or higher is required.")
endif()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fira-loop-pressure -ftree-loop-distribution -floop-interchange -fipa-pta -fivopts -s")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fpredictive-commoning -ftree-partial-pre -fira-loop-pressure -ftree-loop-distribution -floop-interchange -fsplit-paths -fipa-pta -fivopts -s")
set(CMAKE_CXX_FLAGS "-fno-use-linker-plugin -fwhole-program ${CMAKE_CXX_FLAGS}")
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${MINIMAL_CLANG})