mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-03 05:08:47 -06:00
Merge topic 'dir-IMPORTED_TARGETS'
e13704ce72Add directory property to list imported targetsea6d338ea1cmState: Record imported target names in each directory Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6215
This commit is contained in:
@@ -4134,6 +4134,7 @@ cmTarget* cmMakefile::AddImportedTarget(const std::string& name,
|
||||
// Add to the set of available imported targets.
|
||||
this->ImportedTargets[name] = target.get();
|
||||
this->GetGlobalGenerator()->IndexTarget(target.get());
|
||||
this->GetStateSnapshot().GetDirectory().AddImportedTargetName(name);
|
||||
|
||||
// Transfer ownership to this cmMakefile object.
|
||||
this->ImportedTargetsOwned.push_back(std::move(target));
|
||||
|
||||
@@ -286,6 +286,7 @@ cmStateSnapshot cmState::Reset()
|
||||
it->LinkDirectoriesBacktraces.clear();
|
||||
it->DirectoryEnd = pos;
|
||||
it->NormalTargetNames.clear();
|
||||
it->ImportedTargetNames.clear();
|
||||
it->Properties.Clear();
|
||||
it->Children.clear();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
#include <vector>
|
||||
|
||||
#include <cm/iterator>
|
||||
#include <cm/string_view>
|
||||
#include <cmext/algorithm>
|
||||
#include <cmext/string_view>
|
||||
|
||||
#include "cmAlgorithms.h"
|
||||
#include "cmProperty.h"
|
||||
@@ -475,6 +477,10 @@ cmProp cmStateDirectory::GetProperty(const std::string& prop, bool chain) const
|
||||
output = cmJoin(this->DirectoryState->NormalTargetNames, ";");
|
||||
return &output;
|
||||
}
|
||||
if (prop == "IMPORTED_TARGETS"_s) {
|
||||
output = cmJoin(this->DirectoryState->ImportedTargetNames, ";");
|
||||
return &output;
|
||||
}
|
||||
|
||||
if (prop == "LISTFILE_STACK") {
|
||||
std::vector<std::string> listFiles;
|
||||
@@ -546,3 +552,8 @@ void cmStateDirectory::AddNormalTargetName(std::string const& name)
|
||||
{
|
||||
this->DirectoryState->NormalTargetNames.push_back(name);
|
||||
}
|
||||
|
||||
void cmStateDirectory::AddImportedTargetName(std::string const& name)
|
||||
{
|
||||
this->DirectoryState->ImportedTargetNames.emplace_back(name);
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ public:
|
||||
std::vector<std::string> GetPropertyKeys() const;
|
||||
|
||||
void AddNormalTargetName(std::string const& name);
|
||||
void AddImportedTargetName(std::string const& name);
|
||||
|
||||
private:
|
||||
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator
|
||||
|
||||
@@ -83,6 +83,7 @@ struct cmStateDetail::BuildsystemDirectoryStateType
|
||||
std::vector<cmListFileBacktrace> LinkDirectoriesBacktraces;
|
||||
|
||||
std::vector<std::string> NormalTargetNames;
|
||||
std::vector<std::string> ImportedTargetNames;
|
||||
|
||||
std::string ProjectName;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user