summaryrefslogtreecommitdiffstats
path: root/Source/cmExtraSublimeTextGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmExtraSublimeTextGenerator.cxx')
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx55
1 files changed, 23 insertions, 32 deletions
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index bd0a261..78cf3ec 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -68,11 +68,9 @@ void cmExtraSublimeTextGenerator::Generate()
"CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS");
// for each sub project in the project create a sublime text 2 project
- for (std::map<std::string, std::vector<cmLocalGenerator*>>::const_iterator
- it = this->GlobalGenerator->GetProjectMap().begin();
- it != this->GlobalGenerator->GetProjectMap().end(); ++it) {
+ for (auto const& it : this->GlobalGenerator->GetProjectMap()) {
// create a project file
- this->CreateProjectFile(it->second);
+ this->CreateProjectFile(it.second);
}
}
@@ -144,20 +142,19 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile(
fout << "\n\t{";
fout << "\n\t\t" << systemName << ":";
fout << "\n\t\t{";
- for (std::vector<std::string>::iterator i = tokens.begin();
- i != tokens.end(); ++i) {
- size_t const pos = i->find_first_of('=');
+ for (std::string const& t : tokens) {
+ size_t const pos = t.find_first_of('=');
if (pos != std::string::npos) {
- std::string varName = i->substr(0, pos);
- std::string varValue = i->substr(pos + 1);
+ std::string varName = t.substr(0, pos);
+ std::string varValue = t.substr(pos + 1);
fout << "\n\t\t\t\"" << varName << "\":\"" << varValue << "\"";
} else {
std::ostringstream e;
e << "Could not parse Env Vars specified in "
"\"CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS\""
- << ", corrupted string " << *i;
+ << ", corrupted string " << t;
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
}
}
@@ -182,21 +179,18 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
// add all executable and library targets and some of the GLOBAL
// and UTILITY targets
- for (std::vector<cmLocalGenerator*>::const_iterator lg = lgs.begin();
- lg != lgs.end(); lg++) {
- cmMakefile* makefile = (*lg)->GetMakefile();
- const std::vector<cmGeneratorTarget*>& targets =
- (*lg)->GetGeneratorTargets();
- for (std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin();
- ti != targets.end(); ti++) {
- std::string targetName = (*ti)->GetName();
- switch ((*ti)->GetType()) {
+ for (cmLocalGenerator* lg : lgs) {
+ cmMakefile* makefile = lg->GetMakefile();
+ const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets();
+ for (cmGeneratorTarget* target : targets) {
+ std::string targetName = target->GetName();
+ switch (target->GetType()) {
case cmStateEnums::GLOBAL_TARGET: {
// Only add the global targets from CMAKE_BINARY_DIR,
// not from the subdirs
- if (strcmp((*lg)->GetCurrentBinaryDirectory(),
- (*lg)->GetBinaryDirectory()) == 0) {
- this->AppendTarget(fout, targetName, *lg, nullptr, make.c_str(),
+ if (strcmp(lg->GetCurrentBinaryDirectory(),
+ lg->GetBinaryDirectory()) == 0) {
+ this->AppendTarget(fout, targetName, lg, nullptr, make.c_str(),
makefile, compiler.c_str(), sourceFileFlags,
false);
}
@@ -213,7 +207,7 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
break;
}
- this->AppendTarget(fout, targetName, *lg, nullptr, make.c_str(),
+ this->AppendTarget(fout, targetName, lg, nullptr, make.c_str(),
makefile, compiler.c_str(), sourceFileFlags,
false);
break;
@@ -222,12 +216,12 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::OBJECT_LIBRARY: {
- this->AppendTarget(fout, targetName, *lg, *ti, make.c_str(),
+ this->AppendTarget(fout, targetName, lg, target, make.c_str(),
makefile, compiler.c_str(), sourceFileFlags,
false);
std::string fastTarget = targetName;
fastTarget += "/fast";
- this->AppendTarget(fout, fastTarget, *lg, *ti, make.c_str(),
+ this->AppendTarget(fout, fastTarget, lg, target, make.c_str(),
makefile, compiler.c_str(), sourceFileFlags,
false);
} break;
@@ -249,11 +243,7 @@ void cmExtraSublimeTextGenerator::AppendTarget(
std::vector<cmSourceFile*> sourceFiles;
target->GetSourceFiles(sourceFiles,
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
- std::vector<cmSourceFile*>::const_iterator sourceFilesEnd =
- sourceFiles.end();
- for (std::vector<cmSourceFile*>::const_iterator iter = sourceFiles.begin();
- iter != sourceFilesEnd; ++iter) {
- cmSourceFile* sourceFile = *iter;
+ for (cmSourceFile* sourceFile : sourceFiles) {
MapSourceFileFlags::iterator sourceFileFlagsIter =
sourceFileFlags.find(sourceFile->GetFullPath());
if (sourceFileFlagsIter == sourceFileFlags.end()) {
@@ -264,8 +254,9 @@ void cmExtraSublimeTextGenerator::AppendTarget(
.first;
}
std::vector<std::string>& flags = sourceFileFlagsIter->second;
- std::string flagsString = this->ComputeFlagsForObject(*iter, lg, target);
- std::string definesString = this->ComputeDefines(*iter, lg, target);
+ std::string flagsString =
+ this->ComputeFlagsForObject(sourceFile, lg, target);
+ std::string definesString = this->ComputeDefines(sourceFile, lg, target);
flags.clear();
cmsys::RegularExpression flagRegex;
// Regular expression to extract compiler flags from a string