cmState: Record imported target names in each directory

Model the change after commit 089868a244 (cmState: Record buildsystem
target names in each directory, 2016-09-16, v3.7.0-rc1~79^2~3).
This commit is contained in:
Brad King
2021-06-10 15:38:57 -04:00
parent 5fd68d3ef7
commit ea6d338ea1
5 changed files with 9 additions and 0 deletions

View File

@@ -4134,6 +4134,7 @@ cmTarget* cmMakefile::AddImportedTarget(const std::string& name,
// Add to the set of available imported targets. // Add to the set of available imported targets.
this->ImportedTargets[name] = target.get(); this->ImportedTargets[name] = target.get();
this->GetGlobalGenerator()->IndexTarget(target.get()); this->GetGlobalGenerator()->IndexTarget(target.get());
this->GetStateSnapshot().GetDirectory().AddImportedTargetName(name);
// Transfer ownership to this cmMakefile object. // Transfer ownership to this cmMakefile object.
this->ImportedTargetsOwned.push_back(std::move(target)); this->ImportedTargetsOwned.push_back(std::move(target));

View File

@@ -286,6 +286,7 @@ cmStateSnapshot cmState::Reset()
it->LinkDirectoriesBacktraces.clear(); it->LinkDirectoriesBacktraces.clear();
it->DirectoryEnd = pos; it->DirectoryEnd = pos;
it->NormalTargetNames.clear(); it->NormalTargetNames.clear();
it->ImportedTargetNames.clear();
it->Properties.Clear(); it->Properties.Clear();
it->Children.clear(); it->Children.clear();
} }

View File

@@ -546,3 +546,8 @@ void cmStateDirectory::AddNormalTargetName(std::string const& name)
{ {
this->DirectoryState->NormalTargetNames.push_back(name); this->DirectoryState->NormalTargetNames.push_back(name);
} }
void cmStateDirectory::AddImportedTargetName(std::string const& name)
{
this->DirectoryState->ImportedTargetNames.emplace_back(name);
}

View File

@@ -81,6 +81,7 @@ public:
std::vector<std::string> GetPropertyKeys() const; std::vector<std::string> GetPropertyKeys() const;
void AddNormalTargetName(std::string const& name); void AddNormalTargetName(std::string const& name);
void AddImportedTargetName(std::string const& name);
private: private:
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator

View File

@@ -83,6 +83,7 @@ struct cmStateDetail::BuildsystemDirectoryStateType
std::vector<cmListFileBacktrace> LinkDirectoriesBacktraces; std::vector<cmListFileBacktrace> LinkDirectoriesBacktraces;
std::vector<std::string> NormalTargetNames; std::vector<std::string> NormalTargetNames;
std::vector<std::string> ImportedTargetNames;
std::string ProjectName; std::string ProjectName;