summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2017-09-07 09:55:52 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2017-09-09 07:44:55 (GMT)
commit1e6569c9f4614b3d915653bab2fd423c99d814d6 (patch)
tree7c8980e81f9805782ae75167c7aaf876bc0d999d /Source/cmMakefile.cxx
parent3e8b3e94dc6d3ea59dd437f1ea46786f9f0ec1d2 (diff)
downloadCMake-1e6569c9f4614b3d915653bab2fd423c99d814d6.zip
CMake-1e6569c9f4614b3d915653bab2fd423c99d814d6.tar.gz
CMake-1e6569c9f4614b3d915653bab2fd423c99d814d6.tar.bz2
cmMakefile: Add GetOrCreateSourceGroup methods
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 24c2de2..c9dc93c 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2010,6 +2010,27 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name,
sg->SetGroupRegex(regex);
}
+cmSourceGroup* cmMakefile::GetOrCreateSourceGroup(
+ const std::vector<std::string>& folders)
+{
+ cmSourceGroup* sg = this->GetSourceGroup(folders);
+ if (sg == nullptr) {
+ this->AddSourceGroup(folders);
+ sg = this->GetSourceGroup(folders);
+ }
+ return sg;
+}
+
+cmSourceGroup* cmMakefile::GetOrCreateSourceGroup(const std::string& name)
+{
+ const char* delimiter = this->GetDefinition("SOURCE_GROUP_DELIMITER");
+ if (delimiter == nullptr) {
+ delimiter = "\\";
+ }
+ return this->GetOrCreateSourceGroup(
+ cmSystemTools::tokenize(name, delimiter));
+}
+
/**
* Find a source group whose regular expression matches the filename
* part of the given source name. Search backward through the list of