summaryrefslogtreecommitdiffstats
path: root/Source/cmSourceGroupCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-09-12 13:38:03 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-09-12 13:38:24 (GMT)
commitcb171502287db0e4911faa10d748c72f08e5a9dd (patch)
treed51e973edeac480e1ab4383970bfcad35078883e /Source/cmSourceGroupCommand.cxx
parent3f8c6cab4bb4a9f68708c11a38e4487dad363e38 (diff)
parent95b17c89be15a768178d66f42573d90852a1b986 (diff)
downloadCMake-cb171502287db0e4911faa10d748c72f08e5a9dd.zip
CMake-cb171502287db0e4911faa10d748c72f08e5a9dd.tar.gz
CMake-cb171502287db0e4911faa10d748c72f08e5a9dd.tar.bz2
Merge topic 'get-or-create-source-group'
95b17c89 Use cmMakefile::GetOrCreateSourceGroup in cmQtAutogeneratorsInitializer a451995f Use cmMakefile::GetOrCreateSourceGroup in cmSourceGroupCommand 1e6569c9 cmMakefile: Add GetOrCreateSourceGroup methods 3e8b3e94 cmMakefile: Collect source group methods in one place Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1243
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 77fde7b..890109e 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");