summaryrefslogtreecommitdiff
path: root/Source/cmSourceGroupCommand.cxx
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2017-09-07 12:00:13 +0200
committerSebastian Holtermann <sebholt@xwmw.org>2017-09-09 09:44:55 +0200
commita451995fc6485929bc606986572eee162d6fc4e4 (patch)
treea1f8eac2d972891d27726e08095797d8fdfa1725 /Source/cmSourceGroupCommand.cxx
parent1e6569c9f4614b3d915653bab2fd423c99d814d6 (diff)
downloadcmake-a451995fc6485929bc606986572eee162d6fc4e4.tar.gz
Use cmMakefile::GetOrCreateSourceGroup in cmSourceGroupCommand
Diffstat (limited to 'Source/cmSourceGroupCommand.cxx')
-rw-r--r--Source/cmSourceGroupCommand.cxx34
1 files changed, 2 insertions, 32 deletions
diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx
index 77fde7b3b7..890109e5ff 100644
--- a/Source/cmSourceGroupCommand.cxx
+++ b/Source/cmSourceGroupCommand.cxx
@@ -61,23 +61,6 @@ bool rootIsPrefix(const std::string& root,
return true;
}
-cmSourceGroup* addSourceGroup(const std::vector<std::string>& tokenizedPath,
- cmMakefile& makefile)
-{
- cmSourceGroup* sg;
-
- sg = makefile.GetSourceGroup(tokenizedPath);
- if (!sg) {
- makefile.AddSourceGroup(tokenizedPath);
- sg = makefile.GetSourceGroup(tokenizedPath);
- if (!sg) {
- return nullptr;
- }
- }
-
- return sg;
-}
-
std::string prepareFilePathForTree(const std::string& path,
const std::string& currentSourceDir)
{
@@ -121,7 +104,7 @@ bool addFilesToItsSourceGroups(const std::string& root,
if (tokenizedPath.size() > 1) {
tokenizedPath.pop_back();
- sg = addSourceGroup(tokenizedPath, makefile);
+ sg = makefile.GetOrCreateSourceGroup(tokenizedPath);
if (!sg) {
errorMsg = "Could not create source group for file: " + *it;
@@ -158,20 +141,7 @@ bool cmSourceGroupCommand::InitialPass(std::vector<std::string> const& args,
return true;
}
- std::string delimiter = "\\";
- if (this->Makefile->GetDefinition("SOURCE_GROUP_DELIMITER")) {
- delimiter = this->Makefile->GetDefinition("SOURCE_GROUP_DELIMITER");
- }
-
- std::vector<std::string> folders =
- cmSystemTools::tokenize(args[0], delimiter);
-
- cmSourceGroup* sg = nullptr;
- sg = this->Makefile->GetSourceGroup(folders);
- if (!sg) {
- this->Makefile->AddSourceGroup(folders);
- sg = this->Makefile->GetSourceGroup(folders);
- }
+ cmSourceGroup* sg = this->Makefile->GetOrCreateSourceGroup(args[0]);
if (!sg) {
this->SetError("Could not create or find source group");