CMakeLists.txt: Set CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE to YES when using a llvm-mingw toolchain

Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
Username404 2022-08-28 15:14:51 +02:00
parent 23f24e55b1
commit 8091d92933
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 4 additions and 1 deletions

View File

@ -114,7 +114,10 @@ elseif(${IS_CLANG})
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${MINIMAL_CLANG} AND NOT ${IGNORE_MINIMAL_COMPILER_VERSION})
message(FATAL_ERROR "Clang ${MINIMAL_CLANG} or higher is required.")
endif()
if (${CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE} OR (MINGW AND NOT USER_DEFINED_INTERPROCEDURAL_OPTIMIZATION_RELEASE)) # CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE is false on llvm-mingw toolchains even though it is supported
if (MINGW AND NOT USER_DEFINED_INTERPROCEDURAL_OPTIMIZATION_RELEASE) # CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE is false on llvm-mingw toolchains even though it is supported
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE YES)
endif()
if (CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto=thin")
if (NOT DEFINED EMSCRIPTEN)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fwhole-program-vtables")