1
0
mirror of synced 2024-11-12 10:10:53 +01:00

build: Fix LTO not being enabled correctly (#1217)

Currently, LTO isn't enabled (at least on Linux ?), because LTO doesn't
recognize any language as being enabled.

I fixed that by explicitly enabling C and CXX languages before enabling
LTO
This commit is contained in:
iTrooz 2023-08-05 20:39:20 +02:00 committed by GitHub
parent 1a765ee5ab
commit 55e6761bf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -277,6 +277,9 @@ endfunction()
macro(configureCMake)
message(STATUS "Configuring ImHex v${IMHEX_VERSION}")
# Enable C and C++ languages
enable_language(C CXX)
# Configure use of recommended build tools
if (IMHEX_USE_DEFAULT_BUILD_SETTINGS)
message(STATUS "Configuring CMake to use recommended build tools...")
@ -335,12 +338,12 @@ macro(configureCMake)
if (IMHEX_ENABLE_LTO)
include(CheckIPOSupported)
check_ipo_supported(RESULT result)
check_ipo_supported(RESULT result OUTPUT output_error)
if (result)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
message(STATUS "LTO enabled!")
else ()
message(WARNING "LTO is not supported!")
message(WARNING "LTO is not supported: ${output_error}")
endif ()
endif ()