summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-11 10:11:37 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-06-11 10:11:42 (GMT)
commitf597bb396edfde86cfb953faf841940e58a0cd6e (patch)
tree70259a9486398dce98ad47e03176d5cfd30faf8c /Source
parent15b1d5ab9cdb8cafe74d0a30ca46d6a06e1838b7 (diff)
parente13704ce72a49684a835ab7ee3db9c2a928b5db5 (diff)
downloadCMake-f597bb396edfde86cfb953faf841940e58a0cd6e.zip
CMake-f597bb396edfde86cfb953faf841940e58a0cd6e.tar.gz
CMake-f597bb396edfde86cfb953faf841940e58a0cd6e.tar.bz2
Merge topic 'dir-IMPORTED_TARGETS'
e13704ce72 Add directory property to list imported targets ea6d338ea1 cmState: Record imported target names in each directory Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6215
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefile.cxx1
-rw-r--r--Source/cmState.cxx1
-rw-r--r--Source/cmStateDirectory.cxx11
-rw-r--r--Source/cmStateDirectory.h1
-rw-r--r--Source/cmStatePrivate.h1
5 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 908b3f0..d2d34f9 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -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));
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index d97762b..0b8a64b 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -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();
}
diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx
index 9ae2861..c898dd4 100644
--- a/Source/cmStateDirectory.cxx
+++ b/Source/cmStateDirectory.cxx
@@ -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);
+}
diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h
index ce00dbb..b8abccb 100644
--- a/Source/cmStateDirectory.h
+++ b/Source/cmStateDirectory.h
@@ -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
diff --git a/Source/cmStatePrivate.h b/Source/cmStatePrivate.h
index a437ce2..6f475f2 100644
--- a/Source/cmStatePrivate.h
+++ b/Source/cmStatePrivate.h
@@ -83,6 +83,7 @@ struct cmStateDetail::BuildsystemDirectoryStateType
std::vector<cmListFileBacktrace> LinkDirectoriesBacktraces;
std::vector<std::string> NormalTargetNames;
+ std::vector<std::string> ImportedTargetNames;
std::string ProjectName;