From ddac172cba33db77143b9df4e5ad32be4e19cff6 Mon Sep 17 00:00:00 2001 From: Sam James Date: Thu, 19 Jun 2025 20:11:41 +0100 Subject: [PATCH] Disable LTO for qt_add_big_resources In fa44b11bc2b36d5c3cfc5c3403ea75b2fff57253, we went from qt_add_big_resources to qt_add_resources because the former breaks with LTO, then we recently went back to qt_add_big_resources in 75fd5c16d1cf0bb6756d4dedd073fed2ef6ee325 to fix the build on 32-bit machines. That leaves LTO broken: try to use CMake to disable LTO for kbreezeicons rather than asking distributors to disable LTO manually. I tried to use CMake's support for LTO/IPO to disable it per-target but it doesn't actually pass -fno-lto or anything if you're not using CMake's support to enable LTO in the first place. Bug: https://bugs.gentoo.org/956679 Bug: https://bugreports.qt.io/browse/QTBUG-41301 BUG: 487452 BUG: 499674 --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e90cc0499..71c0a07f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,17 @@ find_package(Python 3 COMPONENTS Interpreter) set(CMAKE_POSITION_INDEPENDENT_CODE ON) +# We need this for KDE-BUG 499674. qt_add_resources has issues with 32-bit +# systems, while qt_add_big_resources has issues with LTO. We use qt_add_big_resources +# and disable LTO. +check_cxx_compiler_flag(-fno-lto COMPILER_SUPPORTS_NO_LTO) +check_cxx_compiler_flag(/GL- COMPILER_SUPPORTS_NO_GL) +if(COMPILER_SUPPORTS_NO_LTO) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-lto") +elseif(COMPILER_SUPPORTS_NO_GL) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GL-") +endif() + if(Python_FOUND) # Find lxml Python 3 module exec_program(${Python_EXECUTABLE} -- GitLab