summaryrefslogtreecommitdiffstats
path: root/Source/cmState.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-20 12:41:01 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-09-20 12:41:01 (GMT)
commit6b8812c27e6df1d10fa4bfc30cb3eadd08d7966b (patch)
tree6754e589fede866991a21c94b896a50e9c156e54 /Source/cmState.cxx
parent5c1ebec8430fe755f9ef2b0ba3316f424113ecbf (diff)
parentd0be1e15c383f17502d0f47a36d16ba3571b0b79 (diff)
downloadCMake-6b8812c27e6df1d10fa4bfc30cb3eadd08d7966b.zip
CMake-6b8812c27e6df1d10fa4bfc30cb3eadd08d7966b.tar.gz
CMake-6b8812c27e6df1d10fa4bfc30cb3eadd08d7966b.tar.bz2
Merge topic 'directory-list-targets-and-subdirs'
d0be1e15 Add directory properties to get source and binary directories cbca6582 Add directory property to list buildsystem targets 7a4b8d0d Add a directory property to list subdirectories 089868a2 cmState: Record buildsystem target names in each directory
Diffstat (limited to 'Source/cmState.cxx')
-rw-r--r--Source/cmState.cxx37
1 files changed, 37 insertions, 0 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index ffb104b..6b37b92 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -29,6 +29,11 @@
#include <string.h>
#include <utility>
+static std::string const kBINARY_DIR = "BINARY_DIR";
+static std::string const kBUILDSYSTEM_TARGETS = "BUILDSYSTEM_TARGETS";
+static std::string const kSOURCE_DIR = "SOURCE_DIR";
+static std::string const kSUBDIRECTORIES = "SUBDIRECTORIES";
+
struct cmState::SnapshotDataType
{
cmState::PositionType ScopeParent;
@@ -94,6 +99,8 @@ struct cmState::BuildsystemDirectoryStateType
std::vector<std::string> CompileOptions;
std::vector<cmListFileBacktrace> CompileOptionsBacktraces;
+ std::vector<std::string> NormalTargetNames;
+
std::string ProjectName;
cmPropertyMap Properties;
@@ -324,6 +331,7 @@ cmState::Snapshot cmState::Reset()
it->CompileOptions.clear();
it->CompileOptionsBacktraces.clear();
it->DirectoryEnd = pos;
+ it->NormalTargetNames.clear();
it->Properties.clear();
it->Children.clear();
}
@@ -1667,6 +1675,30 @@ const char* cmState::Directory::GetProperty(const std::string& prop,
}
return "";
}
+ if (prop == kBINARY_DIR) {
+ output = this->GetCurrentBinary();
+ return output.c_str();
+ }
+ if (prop == kSOURCE_DIR) {
+ output = this->GetCurrentSource();
+ return output.c_str();
+ }
+ if (prop == kSUBDIRECTORIES) {
+ std::vector<std::string> child_dirs;
+ std::vector<cmState::Snapshot> const& children =
+ this->DirectoryState->Children;
+ for (std::vector<cmState::Snapshot>::const_iterator ci = children.begin();
+ ci != children.end(); ++ci) {
+ child_dirs.push_back(ci->GetDirectory().GetCurrentSource());
+ }
+ output = cmJoin(child_dirs, ";");
+ return output.c_str();
+ }
+ if (prop == kBUILDSYSTEM_TARGETS) {
+ output = cmJoin(this->DirectoryState->NormalTargetNames, ";");
+ return output.c_str();
+ }
+
if (prop == "LISTFILE_STACK") {
std::vector<std::string> listFiles;
cmState::Snapshot snp = this->Snapshot_;
@@ -1733,6 +1765,11 @@ std::vector<std::string> cmState::Directory::GetPropertyKeys() const
return keys;
}
+void cmState::Directory::AddNormalTargetName(std::string const& name)
+{
+ this->DirectoryState->NormalTargetNames.push_back(name);
+}
+
bool operator==(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs)
{
return lhs.Position == rhs.Position;