mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-22 14:23:10 -05:00
Linking: Optionally reorder direct dependencies from LINK_LIBRARIES
Traditionally CMake generates link lines by starting with the direct link dependencies specified by `LINK_LIBRARIES` in their original order and then appending indirect dependencies that the direct dependencies do not express. This gives projects control over ordering among independent entries, which can be important when intermixing flags and libraries, or when multiple libraries provide the same symbol. However, it may also result in inefficient link lines. Add support for an alternative strategy that can reorder direct link dependencies to produce more efficient link lines. This is useful for projects that cannot easily specify their targets' direct dependencies in an order that satisfies indirect dependencies. Add a `CMAKE_LINK_LIBRARIES_STRATEGY` variable and corresponding `LINK_LIBRARIES_STRATEGY` target property to select a strategy. Fixes: #26271
This commit is contained in:
@@ -140,6 +140,11 @@ Items containing ``::``, such as ``Foo::Bar``, are assumed to be
|
||||
target names and will cause an error if no such target exists.
|
||||
See policy :policy:`CMP0028`.
|
||||
|
||||
See the :variable:`CMAKE_LINK_LIBRARIES_STRATEGY` variable and
|
||||
corresponding :prop_tgt:`LINK_LIBRARIES_STRATEGY` target property
|
||||
for details on how CMake orders direct link dependencies on linker
|
||||
command lines.
|
||||
|
||||
See the :manual:`cmake-buildsystem(7)` manual for more on defining
|
||||
buildsystem properties.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user