summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-08-10 15:30:03 (GMT)
committerBrad King <brad.king@kitware.com>2022-08-15 14:40:03 (GMT)
commit0ebff0d61acf27c077545a36ee83526cef22e1fc (patch)
tree03dfed920c4421d20d9d71b126656555aad8ee49 /Source
parent4be24f031a4829db75b85062cc67125035d8831e (diff)
downloadCMake-0ebff0d61acf27c077545a36ee83526cef22e1fc.zip
CMake-0ebff0d61acf27c077545a36ee83526cef22e1fc.tar.gz
CMake-0ebff0d61acf27c077545a36ee83526cef22e1fc.tar.bz2
export: Restore exclusion of private shared library dependencies from checks
Refactoring in commit 8c65b7042e (cmExportFileGenerator: Simplify collection of targets missing from export set, 2022-04-11, v3.24.0-rc1~281^2) accidentally dropped the behavior change from commit 0ad2a1c181 (Export: Never treat private link libraries as public package dependencies., 2013-09-24, v3.0.0-rc1~559^2). Restore the behavior and add a test. Fixes: #23838
Diffstat (limited to 'Source')
-rw-r--r--Source/cmExportFileGenerator.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 452eb99..5a33349 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -843,9 +843,16 @@ void cmExportFileGenerator::SetImportDetailProperties(
suffix, target, "IMPORTED_LINK_INTERFACE_LANGUAGES", iface->Languages,
properties, ImportLinkPropertyTargetNames::No);
+ // Export IMPORTED_LINK_DEPENDENT_LIBRARIES to help consuming linkers
+ // find private dependencies of shared libraries.
+ std::size_t oldMissingTargetsSize = this->MissingTargets.size();
this->SetImportLinkProperty(
suffix, target, "IMPORTED_LINK_DEPENDENT_LIBRARIES", iface->SharedDeps,
properties, ImportLinkPropertyTargetNames::Yes);
+ // Avoid enforcing shared library private dependencies as public package
+ // dependencies by ignoring missing targets added for them.
+ this->MissingTargets.resize(oldMissingTargetsSize);
+
if (iface->Multiplicity > 0) {
std::string prop =
cmStrCat("IMPORTED_LINK_INTERFACE_MULTIPLICITY", suffix);