summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeTargetDepends.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-03-22 13:31:36 (GMT)
committerBrad King <brad.king@kitware.com>2022-03-22 15:57:48 (GMT)
commit73337cb383a704664a47fd3fec84c8feaa303995 (patch)
tree99d8447ed9418486e670ccf6b7f69365bda2615c /Source/cmComputeTargetDepends.cxx
parentc173b1009a12981c91bf9094c58b9b68a3806737 (diff)
downloadCMake-73337cb383a704664a47fd3fec84c8feaa303995.zip
CMake-73337cb383a704664a47fd3fec84c8feaa303995.tar.gz
CMake-73337cb383a704664a47fd3fec84c8feaa303995.tar.bz2
LINK_LIBRARIES: Evaluate separately for linking and usage requirements
We evaluate `LINK_LIBRARIES` and `INTERFACE_LINK_LIBRARIES` for two purposes: * Constructing the link line. * Collecting usage requirements. We evaluate `INTERFACE_LINK_LIBRARIES` separately for each purpose in order to support the `$<LINK_ONLY:...>` generator expression used to express private link dependencies of a static library. Previously we only evaluated `LINK_LIBRARIES` for linking, and used that result for collecting usage requirements too. Therefore `$<LINK_ONLY:...>` does not work in `LINK_LIBRARIES`. With the introduction of `INTERFACE_LINK_LIBRARIES_DIRECT`, evaluation of `LINK_LIBRARIES` now needs to distinguish these two cases in order to honor link dependencies encountered through `$<LINK_ONLY:...>` without also exposing other usage requirements through private dependencies of a static library. Revise internal infrastructure to distinguish the two cases when evaluating `LINK_LIBRARIES`. Make the information available in code paths for `INTERFACE_LINK_LIBRARIES_DIRECT` and `LINK_ONLY`. Defer actually using the information to later commits. Issue: #22496
Diffstat (limited to 'Source/cmComputeTargetDepends.cxx')
-rw-r--r--Source/cmComputeTargetDepends.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index ef89c8b..3ff16a4 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -218,8 +218,8 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
emitted.insert(cmLinkItem(depender, false, cmListFileBacktrace()));
emitted.insert(cmLinkItem(depender, true, cmListFileBacktrace()));
- if (cmLinkImplementation const* impl =
- depender->GetLinkImplementation(it)) {
+ if (cmLinkImplementation const* impl = depender->GetLinkImplementation(
+ it, cmGeneratorTarget::LinkInterfaceFor::Link)) {
for (cmLinkImplItem const& lib : impl->Libraries) {
// Don't emit the same library twice for this target.
if (emitted.insert(lib).second) {