diff options
author | Brad King <brad.king@kitware.com> | 2024-10-25 13:53:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-10-25 14:23:37 (GMT) |
commit | 39fd396421d7b5012e8fb567710ea1c99d67eeab (patch) | |
tree | 3d27db3bd64ef5ee191c388db27b1b3f5f307ed0 /Source | |
parent | ebd038613ebe3722afe78a1cd33c8de7d77075df (diff) | |
download | CMake-39fd396421d7b5012e8fb567710ea1c99d67eeab.zip CMake-39fd396421d7b5012e8fb567710ea1c99d67eeab.tar.gz CMake-39fd396421d7b5012e8fb567710ea1c99d67eeab.tar.bz2 |
LINK_LIBRARIES_STRATEGY: Rename strategies to clarify expectations
Since commit 7abd3137b7 (Linking: Optionally reorder direct dependencies
from LINK_LIBRARIES, 2024-09-19, v3.31.0-rc1~53^2) the strategy name
`PRESERVE_ORDER` has led users to expect that it strictly preserves
order. While the part of the link line generation logic controlled by
`LINK_LIBRARIES_STRATEGY` does preserve order, it is not the last step.
Toolchain-specific de-duplication can cause the order to change on the
actual link line generated in the build system.
Rename the strategies:
* `PRESERVE_ORDER` => `REORDER_MINIMALLY`
* `REORDER` => `REORDER_FREELY`
The new names make it clear that reordering is always possible, just to
varying degrees. Update the `LINK_LIBRARIES_STRATEGY` documentation to
clarify that the strategies do not directly control the final link line.
Fixes: #26400
Issue: #26271
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmComputeLinkDepends.cxx | 4 | ||||
-rw-r--r-- | Source/cmComputeLinkDepends.h | 4 | ||||
-rw-r--r-- | Source/cmComputeLinkInformation.cxx | 10 |
3 files changed, 9 insertions, 9 deletions
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index ab2557b..551a45b 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -1521,14 +1521,14 @@ void cmComputeLinkDepends::OrderLinkEntries() // Start with the original link line. switch (this->Strategy) { - case LinkLibrariesStrategy::PRESERVE_ORDER: { + case LinkLibrariesStrategy::REORDER_MINIMALLY: { // Emit the direct dependencies in their original order. // This gives projects control over ordering. for (size_t originalEntry : this->OriginalEntries) { this->VisitEntry(originalEntry); } } break; - case LinkLibrariesStrategy::REORDER: { + case LinkLibrariesStrategy::REORDER_FREELY: { // Schedule the direct dependencies for emission in topo order. // This may produce more efficient link lines. for (size_t originalEntry : this->OriginalEntries) { diff --git a/Source/cmComputeLinkDepends.h b/Source/cmComputeLinkDepends.h index 8b8aba4..dc2fa45 100644 --- a/Source/cmComputeLinkDepends.h +++ b/Source/cmComputeLinkDepends.h @@ -29,8 +29,8 @@ class cmake; enum class LinkLibrariesStrategy { - PRESERVE_ORDER, - REORDER, + REORDER_MINIMALLY, + REORDER_FREELY, }; /** \class cmComputeLinkDepends diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 26ff326..c2c210b 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -568,12 +568,12 @@ bool cmComputeLinkInformation::Compute() return false; } - LinkLibrariesStrategy strategy = LinkLibrariesStrategy::PRESERVE_ORDER; + LinkLibrariesStrategy strategy = LinkLibrariesStrategy::REORDER_MINIMALLY; if (cmValue s = this->Target->GetProperty("LINK_LIBRARIES_STRATEGY")) { - if (*s == "PRESERVE_ORDER"_s) { - strategy = LinkLibrariesStrategy::PRESERVE_ORDER; - } else if (*s == "REORDER"_s) { - strategy = LinkLibrariesStrategy::REORDER; + if (*s == "REORDER_MINIMALLY"_s) { + strategy = LinkLibrariesStrategy::REORDER_MINIMALLY; + } else if (*s == "REORDER_FREELY"_s) { + strategy = LinkLibrariesStrategy::REORDER_FREELY; } else { this->CMakeInstance->IssueMessage( MessageType::FATAL_ERROR, |