mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 13:15:12 +00:00
Docs: CMake LTO honor global flag
In this example, the IPO/LTO flags should not be added if the general property is already set for all targets via `CMAKE_INTERPROCEDURAL_OPTIMIZATION`. Also, if `CMAKE_INTERPROCEDURAL_OPTIMIZATION` is set to `OFF`, LTO flags should also not be added. This is sometimes needed when working around compiler bugs with IPO/LTO, e.g. on ppc64le with some toolchains.
This commit is contained in:
parent
f61855b9d8
commit
07d6f352a2
@ -500,7 +500,10 @@ You can use these targets to build complex applications. For example, the
|
||||
|
||||
add_library(example MODULE main.cpp)
|
||||
|
||||
target_link_libraries(example PRIVATE pybind11::module pybind11::lto pybind11::windows_extras)
|
||||
target_link_libraries(example PRIVATE pybind11::module pybind11::windows_extras)
|
||||
if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION)
|
||||
target_link_libraries(example PRIVATE pybind11::lto)
|
||||
endif()
|
||||
|
||||
pybind11_extension(example)
|
||||
pybind11_strip(example)
|
||||
|
Loading…
Reference in New Issue
Block a user