@@ -5,8 +5,8 @@ Adds the following targets::
5
5
pybind11::pybind11 - link to headers and pybind11
6
6
pybind11::module - Adds module links
7
7
pybind11::embed - Adds embed links
8
- pybind11::lto - Link time optimizations (manual selection )
9
- pybind11::thin_lto - Link time optimizations (manual selection )
8
+ pybind11::lto - Link time optimizations (only if CMAKE_INTERPROCEDURAL_OPTIMIZATION is not set )
9
+ pybind11::thin_lto - Link time optimizations (only if CMAKE_INTERPROCEDURAL_OPTIMIZATION is not set )
10
10
pybind11::python_link_helper - Adds link to Python libraries
11
11
pybind11::windows_extras - MSVC bigobj and mp for building multithreaded
12
12
pybind11::opt_size - avoid optimizations that increase code size
@@ -20,7 +20,7 @@ Adds the following functions::
20
20
21
21
# CMake 3.10 has an include_guard command, but we can't use that yet
22
22
# include_guard(global) (pre-CMake 3.10)
23
- if (TARGET pybind11::lto )
23
+ if (TARGET pybind11::pybind11 )
24
24
return ()
25
25
endif ()
26
26
@@ -372,11 +372,13 @@ function(_pybind11_generate_lto target prefer_thin_lto)
372
372
endif ()
373
373
endfunction ()
374
374
375
- add_library (pybind11::lto IMPORTED INTERFACE ${optional_global} )
376
- _pybind11_generate_lto(pybind11::lto FALSE )
375
+ if (NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION)
376
+ add_library (pybind11::lto IMPORTED INTERFACE ${optional_global} )
377
+ _pybind11_generate_lto(pybind11::lto FALSE )
377
378
378
- add_library (pybind11::thin_lto IMPORTED INTERFACE ${optional_global} )
379
- _pybind11_generate_lto(pybind11::thin_lto TRUE )
379
+ add_library (pybind11::thin_lto IMPORTED INTERFACE ${optional_global} )
380
+ _pybind11_generate_lto(pybind11::thin_lto TRUE )
381
+ endif ()
380
382
381
383
# ---------------------- pybind11_strip -----------------------------
382
384
0 commit comments