summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeLinkDepends.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-09-06 18:21:06 (GMT)
committerBrad King <brad.king@kitware.com>2018-09-07 13:23:43 (GMT)
commitbea390e9bd68e1aa7d86b6aef7384f502c39068c (patch)
treeb19be7471586c47e8a5b1a72f433a773a62ccee8 /Source/cmComputeLinkDepends.cxx
parentfc7e4d1ed85370d03acbd62bc753cced3550752b (diff)
downloadCMake-bea390e9bd68e1aa7d86b6aef7384f502c39068c.zip
CMake-bea390e9bd68e1aa7d86b6aef7384f502c39068c.tar.gz
CMake-bea390e9bd68e1aa7d86b6aef7384f502c39068c.tar.bz2
Fix dependency propagation through same-name imported targets
If two imported targets in different directories have the same name we should still be able to propagate transitive link dependencies from both. Fix the target and link dependency analyzers to de-duplicate targets using target pointers rather than target names since the pointers will not be duplicated even if the names are. Issue: #18345
Diffstat (limited to 'Source/cmComputeLinkDepends.cxx')
-rw-r--r--Source/cmComputeLinkDepends.cxx19
1 files changed, 9 insertions, 10 deletions
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 3659a1e..aa17de6 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -279,12 +279,12 @@ cmComputeLinkDepends::Compute()
return this->FinalLinkEntries;
}
-std::map<std::string, int>::iterator cmComputeLinkDepends::AllocateLinkEntry(
- std::string const& item)
+std::map<cmLinkItem, int>::iterator cmComputeLinkDepends::AllocateLinkEntry(
+ cmLinkItem const& item)
{
- std::map<std::string, int>::value_type index_entry(
+ std::map<cmLinkItem, int>::value_type index_entry(
item, static_cast<int>(this->EntryList.size()));
- std::map<std::string, int>::iterator lei =
+ std::map<cmLinkItem, int>::iterator lei =
this->LinkEntryIndex.insert(index_entry).first;
this->EntryList.emplace_back();
this->InferredDependSets.push_back(nullptr);
@@ -295,15 +295,14 @@ std::map<std::string, int>::iterator cmComputeLinkDepends::AllocateLinkEntry(
int cmComputeLinkDepends::AddLinkEntry(cmLinkItem const& item)
{
// Check if the item entry has already been added.
- std::map<std::string, int>::iterator lei =
- this->LinkEntryIndex.find(item.AsStr());
+ std::map<cmLinkItem, int>::iterator lei = this->LinkEntryIndex.find(item);
if (lei != this->LinkEntryIndex.end()) {
// Yes. We do not need to follow the item's dependencies again.
return lei->second;
}
// Allocate a spot for the item entry.
- lei = this->AllocateLinkEntry(item.AsStr());
+ lei = this->AllocateLinkEntry(item);
// Initialize the item entry.
int index = lei->second;
@@ -397,11 +396,11 @@ void cmComputeLinkDepends::QueueSharedDependencies(
void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
{
// Check if the target already has an entry.
- std::map<std::string, int>::iterator lei =
- this->LinkEntryIndex.find(dep.Item.AsStr());
+ std::map<cmLinkItem, int>::iterator lei =
+ this->LinkEntryIndex.find(dep.Item);
if (lei == this->LinkEntryIndex.end()) {
// Allocate a spot for the item entry.
- lei = this->AllocateLinkEntry(dep.Item.AsStr());
+ lei = this->AllocateLinkEntry(dep.Item);
// Initialize the item entry.
LinkEntry& entry = this->EntryList[lei->second];