commit:     1d5d6cb751e803d7e4d525e8a01d72786b400942
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  5 20:34:28 2025 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Oct 16 19:13:57 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1d5d6cb7

cmake.eclass: disable automagic LTO

Pass -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF to avoid automagically
enabling LTO if the compiler supports it.

Note that unlike what we do w/ meson.eclass, we can't do some magic
with `tc-is-lto` here because CMake doesn't allow refining the parallelism
used. But that's fine.

This change still allows using LTO via *FLAGS which is what we tell
people to do.

Closes: https://bugs.gentoo.org/927157
Signed-off-by: Sam James <sam <AT> gentoo.org>
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 eclass/cmake.eclass | 1 +
 1 file changed, 1 insertion(+)

diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index 0a8b93c215aa..7526d492493f 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -633,6 +633,7 @@ cmake_src_configure() {
                set(BUILD_SHARED_LIBS ON CACHE BOOL "")
                set(Python3_FIND_UNVERSIONED_NAMES FIRST CACHE STRING "")
                set(CMAKE_DISABLE_PRECOMPILE_HEADERS ON CACHE BOOL "")
+               set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF CACHE BOOL "")
                set(CMAKE_TLS_VERIFY ON CACHE BOOL "")
                set(CMAKE_COMPILE_WARNING_AS_ERROR OFF CACHE BOOL "")
        _EOF_

Reply via email to