summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-19 17:32:29 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-19 17:59:43 (GMT)
commit7a4b8d0dc2f1e780f14e35e1c7ea32dde90576a4 (patch)
tree5e94735e2609b79245312e3afe9070b03b8fa284 /Source
parent089868a244e623f75c1ffbe9297d3228bef9a8f1 (diff)
downloadCMake-7a4b8d0dc2f1e780f14e35e1c7ea32dde90576a4.zip
CMake-7a4b8d0dc2f1e780f14e35e1c7ea32dde90576a4.tar.gz
CMake-7a4b8d0dc2f1e780f14e35e1c7ea32dde90576a4.tar.bz2
Add a directory property to list subdirectories
Add a SUBDIRECTORIES directory property to allow project code to traverse the directory structure of itself as CMake sees it.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmState.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 2ff4516..325ca76 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -29,6 +29,8 @@
#include <string.h>
#include <utility>
+static std::string const kSUBDIRECTORIES = "SUBDIRECTORIES";
+
struct cmState::SnapshotDataType
{
cmState::PositionType ScopeParent;
@@ -1670,6 +1672,18 @@ const char* cmState::Directory::GetProperty(const std::string& prop,
}
return "";
}
+ 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 == "LISTFILE_STACK") {
std::vector<std::string> listFiles;
cmState::Snapshot snp = this->Snapshot_;