From 580494c7b40f31d21d1855494d1ea1e889c863cc Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Tue, 12 Aug 2025 15:00:33 +0200 Subject: [PATCH] fix: LTO warning of gcc >= 11.4 (#5791) lto-wrapper: warning: using serial compilation of n LTRANS jobs https://stackoverflow.com/questions/72218980/gcc-v12-1-warning-about-serial-compilation --- tools/pybind11Common.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/pybind11Common.cmake b/tools/pybind11Common.cmake index 7ca700f50..1c1d4f88a 100644 --- a/tools/pybind11Common.cmake +++ b/tools/pybind11Common.cmake @@ -363,6 +363,11 @@ function(_pybind11_generate_lto target prefer_thin_lto) PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS) endif() if(NOT HAS_FLTO_THIN) + _pybind11_return_if_cxx_and_linker_flags_work( + HAS_FLTO_AUTO "-flto=auto${cxx_append}" "-flto=auto${linker_append}" + PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS) + endif() + if(NOT HAS_FLTO_AUTO) _pybind11_return_if_cxx_and_linker_flags_work( HAS_FLTO "-flto${cxx_append}" "-flto${linker_append}" PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS)