summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-12-16 17:42:29 (GMT)
committerBrad King <brad.king@kitware.com>2021-12-16 21:43:17 (GMT)
commitea050286e7f4b659518bf5b6c4adbddefa3cc9a6 (patch)
tree90849ed084ad953d03d0b84eb812c5383140db55 /Source/cmGlobalGenerator.cxx
parenta97c92e46eff516eb4642776dcf85bd646e63763 (diff)
downloadCMake-ea050286e7f4b659518bf5b6c4adbddefa3cc9a6.zip
CMake-ea050286e7f4b659518bf5b6c4adbddefa3cc9a6.tar.gz
CMake-ea050286e7f4b659518bf5b6c4adbddefa3cc9a6.tar.bz2
CMP0028: Report the target whose link interface has an offending item
Previously items linked via the link interface of a dependency were reported in CMP0028 messages as if directly linked by a target. Clarify the messages to indicate that an offending item is actually in the link interface of a given target, regardless of its consumer. Move the check to the end of generation and look through the final set of link implementations and link interfaces that were used for generation. This avoids repeating messages on link interfaces that have multiple consumers.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 0a2e7b5..6433681 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -328,6 +328,18 @@ bool cmGlobalGenerator::CheckTargetsForMissingSources() const
return failed;
}
+void cmGlobalGenerator::CheckTargetLinkLibraries() const
+{
+ for (const auto& generator : this->LocalGenerators) {
+ for (const auto& gt : generator->GetGeneratorTargets()) {
+ gt->CheckLinkLibraries();
+ }
+ for (const auto& gt : generator->GetOwnedImportedGeneratorTargets()) {
+ gt->CheckLinkLibraries();
+ }
+ }
+}
+
bool cmGlobalGenerator::CheckTargetsForType() const
{
if (!this->GetLanguageEnabled("Swift")) {
@@ -1606,6 +1618,9 @@ void cmGlobalGenerator::Generate()
this->ExtraGenerator->Generate();
}
+ // Perform validation checks on memoized link structures.
+ this->CheckTargetLinkLibraries();
+
if (!this->CMP0042WarnTargets.empty()) {
std::ostringstream w;
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0042) << "\n";