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
This commit is contained in:
Robert Haschke
2025-08-12 15:00:33 +02:00
committed by GitHub
parent 6292b704f6
commit 580494c7b4

View File

@@ -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)