From 55e6761bf14eb0707c8f6cc7dbff8c7445348ea1 Mon Sep 17 00:00:00 2001 From: iTrooz Date: Sat, 5 Aug 2023 20:39:20 +0200 Subject: [PATCH] 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 --- cmake/build_helpers.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index 57d227a5f..ef3ab4d51 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -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 ()