|
|
@@ -436,18 +436,13 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
|
|
|
|
|
|
// now make the allbuild depend on all the non-utility targets
|
|
|
// in the project
|
|
|
- for (std::vector<cmLocalGenerator*>::iterator i = gens.begin();
|
|
|
- i != gens.end(); ++i) {
|
|
|
- cmLocalGenerator* lg = *i;
|
|
|
- if (this->IsExcluded(root, *i)) {
|
|
|
+ for (auto& gen : gens) {
|
|
|
+ if (this->IsExcluded(root, gen)) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- const std::vector<cmGeneratorTarget*>& tgts = lg->GetGeneratorTargets();
|
|
|
- for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
|
|
|
- l != tgts.end(); l++) {
|
|
|
- cmGeneratorTarget* target = *l;
|
|
|
-
|
|
|
+ const std::vector<cmGeneratorTarget*>& tgts = gen->GetGeneratorTargets();
|
|
|
+ for (auto target : tgts) {
|
|
|
if (target->GetType() == cmStateEnums::GLOBAL_TARGET) {
|
|
|
continue;
|
|
|
}
|
|
|
@@ -473,7 +468,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
|
|
|
cmCustomCommandLines commandLines;
|
|
|
commandLines.push_back(makeHelper);
|
|
|
std::vector<std::string> no_byproducts;
|
|
|
- lg->GetMakefile()->AddCustomCommandToTarget(
|
|
|
+ gen->GetMakefile()->AddCustomCommandToTarget(
|
|
|
target->GetName(), no_byproducts, no_depends, commandLines,
|
|
|
cmTarget::POST_BUILD, "Depend check for xcode", dir.c_str(), true,
|
|
|
false, "", false, cmMakefile::AcceptObjectLibraryCommands);
|
|
|
@@ -485,7 +480,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
|
|
|
}
|
|
|
|
|
|
// Refer to the build configuration file for easy editing.
|
|
|
- listfile = lg->GetCurrentSourceDirectory();
|
|
|
+ listfile = gen->GetCurrentSourceDirectory();
|
|
|
listfile += "/";
|
|
|
listfile += "CMakeLists.txt";
|
|
|
target->AddSource(listfile);
|
|
|
@@ -497,9 +492,8 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
|
|
|
cmLocalGenerator* root, std::vector<cmLocalGenerator*> const& gens)
|
|
|
{
|
|
|
std::vector<std::string> lfiles;
|
|
|
- for (std::vector<cmLocalGenerator*>::const_iterator gi = gens.begin();
|
|
|
- gi != gens.end(); ++gi) {
|
|
|
- std::vector<std::string> const& lf = (*gi)->GetMakefile()->GetListFiles();
|
|
|
+ for (auto gen : gens) {
|
|
|
+ std::vector<std::string> const& lf = gen->GetMakefile()->GetListFiles();
|
|
|
lfiles.insert(lfiles.end(), lf.begin(), lf.end());
|
|
|
}
|
|
|
|
|
|
@@ -559,8 +553,8 @@ void cmGlobalXCodeGenerator::SortXCodeObjects()
|
|
|
void cmGlobalXCodeGenerator::ClearXCodeObjects()
|
|
|
{
|
|
|
this->TargetDoneSet.clear();
|
|
|
- for (unsigned int i = 0; i < this->XCodeObjects.size(); ++i) {
|
|
|
- delete this->XCodeObjects[i];
|
|
|
+ for (auto& obj : this->XCodeObjects) {
|
|
|
+ delete obj;
|
|
|
}
|
|
|
this->XCodeObjects.clear();
|
|
|
this->XCodeObjectIDs.clear();
|
|
|
@@ -934,13 +928,11 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
|
|
|
typedef std::map<std::string, cmGeneratorTarget*, cmCompareTargets>
|
|
|
cmSortedTargets;
|
|
|
cmSortedTargets sortedTargets;
|
|
|
- for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
|
|
|
- l != tgts.end(); l++) {
|
|
|
- sortedTargets[(*l)->GetName()] = *l;
|
|
|
+ for (auto tgt : tgts) {
|
|
|
+ sortedTargets[tgt->GetName()] = tgt;
|
|
|
}
|
|
|
- for (cmSortedTargets::iterator l = sortedTargets.begin();
|
|
|
- l != sortedTargets.end(); l++) {
|
|
|
- cmGeneratorTarget* gtgt = l->second;
|
|
|
+ for (auto& sortedTarget : sortedTargets) {
|
|
|
+ cmGeneratorTarget* gtgt = sortedTarget.second;
|
|
|
|
|
|
std::string targetName = gtgt->GetName();
|
|
|
|
|
|
@@ -1043,9 +1035,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
|
|
|
sourceBuildPhase->AddAttribute("buildActionMask",
|
|
|
this->CreateString("2147483647"));
|
|
|
buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
|
|
- for (std::vector<cmXCodeObject*>::iterator i = sourceFiles.begin();
|
|
|
- i != sourceFiles.end(); ++i) {
|
|
|
- buildFiles->AddObject(*i);
|
|
|
+ for (auto& sourceFile : sourceFiles) {
|
|
|
+ buildFiles->AddObject(sourceFile);
|
|
|
}
|
|
|
sourceBuildPhase->AddAttribute("files", buildFiles);
|
|
|
sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
|
|
|
@@ -1061,9 +1052,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
|
|
|
headerBuildPhase->AddAttribute("buildActionMask",
|
|
|
this->CreateString("2147483647"));
|
|
|
buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
|
|
- for (std::vector<cmXCodeObject*>::iterator i = headerFiles.begin();
|
|
|
- i != headerFiles.end(); ++i) {
|
|
|
- buildFiles->AddObject(*i);
|
|
|
+ for (auto& headerFile : headerFiles) {
|
|
|
+ buildFiles->AddObject(headerFile);
|
|
|
}
|
|
|
headerBuildPhase->AddAttribute("files", buildFiles);
|
|
|
headerBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
|
|
|
@@ -1080,9 +1070,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
|
|
|
resourceBuildPhase->AddAttribute("buildActionMask",
|
|
|
this->CreateString("2147483647"));
|
|
|
buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
|
|
- for (std::vector<cmXCodeObject*>::iterator i = resourceFiles.begin();
|
|
|
- i != resourceFiles.end(); ++i) {
|
|
|
- buildFiles->AddObject(*i);
|
|
|
+ for (auto& resourceFile : resourceFiles) {
|
|
|
+ buildFiles->AddObject(resourceFile);
|
|
|
}
|
|
|
resourceBuildPhase->AddAttribute("files", buildFiles);
|
|
|
resourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
|
|
|
@@ -1190,9 +1179,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
|
|
|
this->CreateString("2147483647"));
|
|
|
buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
|
|
frameworkBuildPhase->AddAttribute("files", buildFiles);
|
|
|
- for (std::vector<cmXCodeObject*>::iterator i = externalObjFiles.begin();
|
|
|
- i != externalObjFiles.end(); ++i) {
|
|
|
- buildFiles->AddObject(*i);
|
|
|
+ for (auto& externalObjFile : externalObjFiles) {
|
|
|
+ buildFiles->AddObject(externalObjFile);
|
|
|
}
|
|
|
frameworkBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
|
|
|
this->CreateString("0"));
|
|
|
@@ -1213,14 +1201,13 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
|
|
|
|
|
|
void cmGlobalXCodeGenerator::ForceLinkerLanguages()
|
|
|
{
|
|
|
- for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i) {
|
|
|
+ for (auto& localGenerator : this->LocalGenerators) {
|
|
|
const std::vector<cmGeneratorTarget*>& tgts =
|
|
|
- this->LocalGenerators[i]->GetGeneratorTargets();
|
|
|
+ localGenerator->GetGeneratorTargets();
|
|
|
// All targets depend on the build-system check target.
|
|
|
- for (std::vector<cmGeneratorTarget*>::const_iterator ti = tgts.begin();
|
|
|
- ti != tgts.end(); ++ti) {
|
|
|
+ for (auto tgt : tgts) {
|
|
|
// This makes sure all targets link using the proper language.
|
|
|
- this->ForceLinkerLanguage(*ti);
|
|
|
+ this->ForceLinkerLanguage(tgt);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1241,9 +1228,8 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt)
|
|
|
|
|
|
// If the language is compiled as a source trust Xcode to link with it.
|
|
|
cmLinkImplementation const* impl = gtgt->GetLinkImplementation("NOCONFIG");
|
|
|
- for (std::vector<std::string>::const_iterator li = impl->Languages.begin();
|
|
|
- li != impl->Languages.end(); ++li) {
|
|
|
- if (*li == llang) {
|
|
|
+ for (auto const& Language : impl->Languages) {
|
|
|
+ if (Language == llang) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
@@ -1545,16 +1531,15 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
|
|
|
makefileStream << "all: ";
|
|
|
std::map<const cmCustomCommand*, std::string> tname;
|
|
|
int count = 0;
|
|
|
- for (std::vector<cmCustomCommand>::const_iterator i = commands.begin();
|
|
|
- i != commands.end(); ++i) {
|
|
|
- cmCustomCommandGenerator ccg(*i, configName, this->CurrentLocalGenerator);
|
|
|
+ for (auto const& command : commands) {
|
|
|
+ cmCustomCommandGenerator ccg(command, configName,
|
|
|
+ this->CurrentLocalGenerator);
|
|
|
if (ccg.GetNumberOfCommands() > 0) {
|
|
|
const std::vector<std::string>& outputs = ccg.GetOutputs();
|
|
|
if (!outputs.empty()) {
|
|
|
- for (std::vector<std::string>::const_iterator o = outputs.begin();
|
|
|
- o != outputs.end(); ++o) {
|
|
|
+ for (auto const& output : outputs) {
|
|
|
makefileStream << "\\\n\t"
|
|
|
- << this->ConvertToRelativeForMake(o->c_str());
|
|
|
+ << this->ConvertToRelativeForMake(output.c_str());
|
|
|
}
|
|
|
} else {
|
|
|
std::ostringstream str;
|
|
|
@@ -1565,18 +1550,18 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
|
|
|
}
|
|
|
}
|
|
|
makefileStream << "\n\n";
|
|
|
- for (std::vector<cmCustomCommand>::const_iterator i = commands.begin();
|
|
|
- i != commands.end(); ++i) {
|
|
|
- cmCustomCommandGenerator ccg(*i, configName, this->CurrentLocalGenerator);
|
|
|
+ for (auto const& command : commands) {
|
|
|
+ cmCustomCommandGenerator ccg(command, configName,
|
|
|
+ this->CurrentLocalGenerator);
|
|
|
if (ccg.GetNumberOfCommands() > 0) {
|
|
|
makefileStream << "\n";
|
|
|
const std::vector<std::string>& outputs = ccg.GetOutputs();
|
|
|
if (!outputs.empty()) {
|
|
|
// There is at least one output, start the rule for it
|
|
|
const char* sep = "";
|
|
|
- for (std::vector<std::string>::const_iterator oi = outputs.begin();
|
|
|
- oi != outputs.end(); ++oi) {
|
|
|
- makefileStream << sep << this->ConvertToRelativeForMake(oi->c_str());
|
|
|
+ for (auto const& output : outputs) {
|
|
|
+ makefileStream << sep
|
|
|
+ << this->ConvertToRelativeForMake(output.c_str());
|
|
|
sep = " ";
|
|
|
}
|
|
|
makefileStream << ": ";
|
|
|
@@ -1584,11 +1569,9 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
|
|
|
// There are no outputs. Use the generated force rule name.
|
|
|
makefileStream << tname[&ccg.GetCC()] << ": ";
|
|
|
}
|
|
|
- for (std::vector<std::string>::const_iterator d =
|
|
|
- ccg.GetDepends().begin();
|
|
|
- d != ccg.GetDepends().end(); ++d) {
|
|
|
+ for (auto const& d : ccg.GetDepends()) {
|
|
|
std::string dep;
|
|
|
- if (this->CurrentLocalGenerator->GetRealDependency(*d, configName,
|
|
|
+ if (this->CurrentLocalGenerator->GetRealDependency(d, configName,
|
|
|
dep)) {
|
|
|
makefileStream << "\\\n"
|
|
|
<< this->ConvertToRelativeForMake(dep.c_str());
|
|
|
@@ -1643,9 +1626,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
|
|
|
std::set<std::string> languages;
|
|
|
gtgt->GetLanguages(languages, configName);
|
|
|
std::map<std::string, std::string> cflags;
|
|
|
- for (std::set<std::string>::iterator li = languages.begin();
|
|
|
- li != languages.end(); ++li) {
|
|
|
- std::string const& lang = *li;
|
|
|
+ for (auto const& lang : languages) {
|
|
|
std::string& flags = cflags[lang];
|
|
|
|
|
|
// Add language-specific flags.
|
|
|
@@ -1741,9 +1722,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
|
|
|
} else {
|
|
|
cmXCodeObject* archObjects =
|
|
|
this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
|
|
- for (std::vector<std::string>::iterator i = archs.begin();
|
|
|
- i != archs.end(); i++) {
|
|
|
- archObjects->AddObject(this->CreateString(*i));
|
|
|
+ for (auto& arch : archs) {
|
|
|
+ archObjects->AddObject(this->CreateString(arch));
|
|
|
}
|
|
|
buildSettings->AddAttribute("ARCHS", archObjects);
|
|
|
}
|
|
|
@@ -1968,10 +1948,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
|
|
|
std::set<std::string> emitted;
|
|
|
emitted.insert("/System/Library/Frameworks");
|
|
|
|
|
|
- for (std::vector<std::string>::iterator i = includes.begin();
|
|
|
- i != includes.end(); ++i) {
|
|
|
- if (this->NameResolvesToFramework(*i)) {
|
|
|
- std::string frameworkDir = *i;
|
|
|
+ for (auto& include : includes) {
|
|
|
+ if (this->NameResolvesToFramework(include)) {
|
|
|
+ std::string frameworkDir = include;
|
|
|
frameworkDir += "/../";
|
|
|
frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
|
|
|
if (emitted.insert(frameworkDir).second) {
|
|
|
@@ -1984,9 +1963,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- std::string incpath = this->XCodeEscapePath(*i);
|
|
|
+ std::string incpath = this->XCodeEscapePath(include);
|
|
|
if (emitSystemIncludes &&
|
|
|
- gtgt->IsSystemIncludeDirectory(*i, configName)) {
|
|
|
+ gtgt->IsSystemIncludeDirectory(include, configName)) {
|
|
|
sysdirs.Add(incpath);
|
|
|
} else {
|
|
|
dirs.Add(incpath);
|
|
|
@@ -1996,12 +1975,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
|
|
|
// Add framework search paths needed for linking.
|
|
|
if (cmComputeLinkInformation* cli = gtgt->GetLinkInformation(configName)) {
|
|
|
std::vector<std::string> const& fwDirs = cli->GetFrameworkPaths();
|
|
|
- for (std::vector<std::string>::const_iterator fdi = fwDirs.begin();
|
|
|
- fdi != fwDirs.end(); ++fdi) {
|
|
|
- if (emitted.insert(*fdi).second) {
|
|
|
- std::string incpath = this->XCodeEscapePath(*fdi);
|
|
|
+ for (auto const& fwDir : fwDirs) {
|
|
|
+ if (emitted.insert(fwDir).second) {
|
|
|
+ std::string incpath = this->XCodeEscapePath(fwDir);
|
|
|
if (emitSystemIncludes &&
|
|
|
- gtgt->IsSystemIncludeDirectory(*fdi, configName)) {
|
|
|
+ gtgt->IsSystemIncludeDirectory(fwDir, configName)) {
|
|
|
sysfdirs.Add(incpath);
|
|
|
} else {
|
|
|
fdirs.Add(incpath);
|
|
|
@@ -2029,13 +2007,12 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
|
|
|
// system include directory awareness. We need to also keep on setting
|
|
|
// HEADER_SEARCH_PATHS to work around a missing compile options flag for
|
|
|
// GNU assembly files (#16449)
|
|
|
- for (std::set<std::string>::iterator li = languages.begin();
|
|
|
- li != languages.end(); ++li) {
|
|
|
+ for (auto const& language : languages) {
|
|
|
std::string includeFlags = this->CurrentLocalGenerator->GetIncludeFlags(
|
|
|
- includes, gtgt, *li, true, false, configName);
|
|
|
+ includes, gtgt, language, true, false, configName);
|
|
|
|
|
|
if (!includeFlags.empty()) {
|
|
|
- cflags[*li] += " " + includeFlags;
|
|
|
+ cflags[language] += " " + includeFlags;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -2046,10 +2023,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
|
|
|
std::string optLevel = "0";
|
|
|
|
|
|
// Minimal map of flags to build settings.
|
|
|
- for (std::set<std::string>::iterator li = languages.begin();
|
|
|
- li != languages.end(); ++li) {
|
|
|
- std::string& flags = cflags[*li];
|
|
|
- std::string& gflag = gflags[*li];
|
|
|
+ for (auto const& language : languages) {
|
|
|
+ std::string& flags = cflags[language];
|
|
|
+ std::string& gflag = gflags[language];
|
|
|
std::string oflag =
|
|
|
this->ExtractFlagRegex("(^| )(-Ofast|-Os|-O[0-9]*)( |$)", 2, flags);
|
|
|
if (oflag.size() == 2) {
|
|
|
@@ -2074,10 +2050,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
|
|
|
if (!same_gflags) {
|
|
|
// We can't set the Xcode flag differently depending on the language,
|
|
|
// so put them back in this case.
|
|
|
- for (std::set<std::string>::iterator li = languages.begin();
|
|
|
- li != languages.end(); ++li) {
|
|
|
- cflags[*li] += " ";
|
|
|
- cflags[*li] += gflags[*li];
|
|
|
+ for (auto const& language : languages) {
|
|
|
+ cflags[language] += " ";
|
|
|
+ cflags[language] += gflags[language];
|
|
|
}
|
|
|
debugStr = "NO";
|
|
|
} else if (last_gflag && (last_gflag->empty() || *last_gflag == "-g0")) {
|
|
|
@@ -2094,18 +2069,17 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
|
|
|
this->CreateString("NO"));
|
|
|
buildSettings->AddAttribute("GCC_INLINES_ARE_PRIVATE_EXTERN",
|
|
|
this->CreateString("NO"));
|
|
|
- for (std::set<std::string>::iterator li = languages.begin();
|
|
|
- li != languages.end(); ++li) {
|
|
|
- std::string flags = cflags[*li] + " " + defFlags;
|
|
|
- if (*li == "CXX") {
|
|
|
+ for (auto const& language : languages) {
|
|
|
+ std::string flags = cflags[language] + " " + defFlags;
|
|
|
+ if (language == "CXX") {
|
|
|
buildSettings->AddAttribute("OTHER_CPLUSPLUSFLAGS",
|
|
|
this->CreateString(flags));
|
|
|
- } else if (*li == "Fortran") {
|
|
|
+ } else if (language == "Fortran") {
|
|
|
buildSettings->AddAttribute("IFORT_OTHER_FLAGS",
|
|
|
this->CreateString(flags));
|
|
|
- } else if (*li == "C") {
|
|
|
+ } else if (language == "C") {
|
|
|
buildSettings->AddAttribute("OTHER_CFLAGS", this->CreateString(flags));
|
|
|
- } else if (*li == "Swift") {
|
|
|
+ } else if (language == "Swift") {
|
|
|
buildSettings->AddAttribute("OTHER_SWIFT_FLAGS",
|
|
|
this->CreateString(flags));
|
|
|
}
|
|
|
@@ -2229,15 +2203,14 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
|
|
|
// Convert "XCODE_ATTRIBUTE_*" properties directly.
|
|
|
{
|
|
|
std::vector<std::string> const& props = gtgt->GetPropertyKeys();
|
|
|
- for (std::vector<std::string>::const_iterator i = props.begin();
|
|
|
- i != props.end(); ++i) {
|
|
|
- if (i->find("XCODE_ATTRIBUTE_") == 0) {
|
|
|
- std::string attribute = i->substr(16);
|
|
|
+ for (auto const& prop : props) {
|
|
|
+ if (prop.find("XCODE_ATTRIBUTE_") == 0) {
|
|
|
+ std::string attribute = prop.substr(16);
|
|
|
this->FilterConfigurationAttribute(configName, attribute);
|
|
|
if (!attribute.empty()) {
|
|
|
cmGeneratorExpression ge;
|
|
|
std::string processed =
|
|
|
- ge.Parse(gtgt->GetProperty(*i))
|
|
|
+ ge.Parse(gtgt->GetProperty(prop))
|
|
|
->Evaluate(this->CurrentLocalGenerator, configName);
|
|
|
buildSettings->AddAttribute(attribute,
|
|
|
this->CreateString(processed));
|
|
|
@@ -2325,15 +2298,15 @@ std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
|
|
|
configlist->SetComment(comment);
|
|
|
target->AddAttribute("buildConfigurationList",
|
|
|
this->CreateObjectReference(configlist));
|
|
|
- for (unsigned int i = 0; i < configVector.size(); ++i) {
|
|
|
+ for (auto const& i : configVector) {
|
|
|
cmXCodeObject* config =
|
|
|
this->CreateObject(cmXCodeObject::XCBuildConfiguration);
|
|
|
buildConfigurations->AddObject(config);
|
|
|
cmXCodeObject* buildSettings =
|
|
|
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
|
|
|
- this->CreateBuildSettings(gtgt, buildSettings, configVector[i]);
|
|
|
- config->AddAttribute("name", this->CreateString(configVector[i]));
|
|
|
- config->SetComment(configVector[i]);
|
|
|
+ this->CreateBuildSettings(gtgt, buildSettings, i);
|
|
|
+ config->AddAttribute("name", this->CreateString(i));
|
|
|
+ config->SetComment(i);
|
|
|
config->AddAttribute("buildSettings", buildSettings);
|
|
|
}
|
|
|
if (!configVector.empty()) {
|
|
|
@@ -2562,15 +2535,14 @@ void cmGlobalXCodeGenerator::AppendBuildSettingAttribute(
|
|
|
std::vector<cmXCodeObject*> list = buildConfigs->GetObjectList();
|
|
|
// each configuration and the target itself has a buildSettings in it
|
|
|
// list.push_back(target);
|
|
|
- for (std::vector<cmXCodeObject*>::iterator i = list.begin(); i != list.end();
|
|
|
- ++i) {
|
|
|
+ for (auto& i : list) {
|
|
|
if (!configName.empty()) {
|
|
|
- if ((*i)->GetObject("name")->GetString() == configName) {
|
|
|
- cmXCodeObject* settings = (*i)->GetObject("buildSettings");
|
|
|
+ if (i->GetObject("name")->GetString() == configName) {
|
|
|
+ cmXCodeObject* settings = i->GetObject("buildSettings");
|
|
|
this->AppendOrAddBuildSetting(settings, attribute, value);
|
|
|
}
|
|
|
} else {
|
|
|
- cmXCodeObject* settings = (*i)->GetObject("buildSettings");
|
|
|
+ cmXCodeObject* settings = i->GetObject("buildSettings");
|
|
|
this->AppendOrAddBuildSetting(settings, attribute, value);
|
|
|
}
|
|
|
}
|
|
|
@@ -2589,20 +2561,15 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
|
|
|
|
|
|
// Add dependencies on other CMake targets.
|
|
|
TargetDependSet const& deps = this->GetTargetDirectDepends(gt);
|
|
|
- for (TargetDependSet::const_iterator i = deps.begin(); i != deps.end();
|
|
|
- ++i) {
|
|
|
- if (cmXCodeObject* dptarget = this->FindXCodeTarget(*i)) {
|
|
|
+ for (auto dep : deps) {
|
|
|
+ if (cmXCodeObject* dptarget = this->FindXCodeTarget(dep)) {
|
|
|
this->AddDependTarget(target, dptarget);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// Loop over configuration types and set per-configuration info.
|
|
|
- for (std::vector<std::string>::iterator i =
|
|
|
- this->CurrentConfigurationTypes.begin();
|
|
|
- i != this->CurrentConfigurationTypes.end(); ++i) {
|
|
|
+ for (auto const& configName : this->CurrentConfigurationTypes) {
|
|
|
// Get the current configuration name.
|
|
|
- std::string configName = *i;
|
|
|
-
|
|
|
if (this->XcodeVersion >= 50) {
|
|
|
// Add object library contents as link flags.
|
|
|
std::string linkObjs;
|
|
|
@@ -2638,9 +2605,8 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
|
|
|
// Add dependencies directly on library files.
|
|
|
{
|
|
|
std::vector<std::string> const& libDeps = cli.GetDepends();
|
|
|
- for (std::vector<std::string>::const_iterator j = libDeps.begin();
|
|
|
- j != libDeps.end(); ++j) {
|
|
|
- target->AddDependLibrary(configName, *j);
|
|
|
+ for (auto const& libDep : libDeps) {
|
|
|
+ target->AddDependLibrary(configName, libDep);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -2648,16 +2614,15 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
|
|
|
{
|
|
|
std::vector<std::string> const& libDirs = cli.GetDirectories();
|
|
|
std::string linkDirs;
|
|
|
- for (std::vector<std::string>::const_iterator libDir = libDirs.begin();
|
|
|
- libDir != libDirs.end(); ++libDir) {
|
|
|
- if (!libDir->empty() && *libDir != "/usr/lib") {
|
|
|
+ for (auto const& libDir : libDirs) {
|
|
|
+ if (!libDir.empty() && libDir != "/usr/lib") {
|
|
|
// Now add the same one but append
|
|
|
// $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) to it:
|
|
|
linkDirs += " ";
|
|
|
linkDirs += this->XCodeEscapePath(
|
|
|
- *libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)");
|
|
|
+ libDir + "/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)");
|
|
|
linkDirs += " ";
|
|
|
- linkDirs += this->XCodeEscapePath(*libDir);
|
|
|
+ linkDirs += this->XCodeEscapePath(libDir);
|
|
|
}
|
|
|
}
|
|
|
this->AppendBuildSettingAttribute(target, "LIBRARY_SEARCH_PATHS",
|
|
|
@@ -2670,18 +2635,18 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
|
|
|
const char* sep = "";
|
|
|
typedef cmComputeLinkInformation::ItemVector ItemVector;
|
|
|
ItemVector const& libNames = cli.GetItems();
|
|
|
- for (ItemVector::const_iterator li = libNames.begin();
|
|
|
- li != libNames.end(); ++li) {
|
|
|
+ for (auto const& libName : libNames) {
|
|
|
linkLibs += sep;
|
|
|
sep = " ";
|
|
|
- if (li->IsPath) {
|
|
|
- linkLibs += this->XCodeEscapePath(li->Value);
|
|
|
- } else if (!li->Target ||
|
|
|
- li->Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
|
|
|
- linkLibs += li->Value;
|
|
|
+ if (libName.IsPath) {
|
|
|
+ linkLibs += this->XCodeEscapePath(libName.Value);
|
|
|
+ } else if (!libName.Target ||
|
|
|
+ libName.Target->GetType() !=
|
|
|
+ cmStateEnums::INTERFACE_LIBRARY) {
|
|
|
+ linkLibs += libName.Value;
|
|
|
}
|
|
|
- if (li->Target && !li->Target->IsImported()) {
|
|
|
- target->AddDependTarget(configName, li->Target->GetName());
|
|
|
+ if (libName.Target && !libName.Target->IsImported()) {
|
|
|
+ target->AddDependTarget(configName, libName.Target->GetName());
|
|
|
}
|
|
|
}
|
|
|
this->AppendBuildSettingAttribute(
|
|
|
@@ -2693,15 +2658,12 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
|
|
|
bool cmGlobalXCodeGenerator::CreateGroups(
|
|
|
std::vector<cmLocalGenerator*>& generators)
|
|
|
{
|
|
|
- for (std::vector<cmLocalGenerator*>::iterator i = generators.begin();
|
|
|
- i != generators.end(); ++i) {
|
|
|
- cmMakefile* mf = (*i)->GetMakefile();
|
|
|
+ for (auto& generator : generators) {
|
|
|
+ cmMakefile* mf = generator->GetMakefile();
|
|
|
std::vector<cmSourceGroup> sourceGroups = mf->GetSourceGroups();
|
|
|
- const std::vector<cmGeneratorTarget*>& tgts = (*i)->GetGeneratorTargets();
|
|
|
- for (std::vector<cmGeneratorTarget*>::const_iterator l = tgts.begin();
|
|
|
- l != tgts.end(); l++) {
|
|
|
- cmGeneratorTarget* gtgt = *l;
|
|
|
-
|
|
|
+ const std::vector<cmGeneratorTarget*>& tgts =
|
|
|
+ generator->GetGeneratorTargets();
|
|
|
+ for (auto gtgt : tgts) {
|
|
|
// Same skipping logic here as in CreateXCodeTargets so that we do not
|
|
|
// end up with (empty anyhow) ALL_BUILD and XCODE_DEPEND_HELPER source
|
|
|
// groups:
|
|
|
@@ -2725,10 +2687,8 @@ bool cmGlobalXCodeGenerator::CreateGroups(
|
|
|
gtgt->GetAllConfigSources();
|
|
|
|
|
|
// Put cmSourceFile instances in proper groups:
|
|
|
- for (std::vector<cmGeneratorTarget::AllConfigSource>::const_iterator si =
|
|
|
- sources.begin();
|
|
|
- si != sources.end(); ++si) {
|
|
|
- cmSourceFile const* sf = si->Source;
|
|
|
+ for (auto const& si : sources) {
|
|
|
+ cmSourceFile const* sf = si.Source;
|
|
|
if (this->XcodeVersion >= 50 && !sf->GetObjectLibrary().empty()) {
|
|
|
// Object library files go on the link line instead.
|
|
|
continue;
|
|
|
@@ -2824,13 +2784,13 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(
|
|
|
cmSystemTools::tokenize(sg->GetFullName(), "\\");
|
|
|
std::string curr_folder = target;
|
|
|
curr_folder += "/";
|
|
|
- for (std::vector<std::string>::size_type i = 0; i < folders.size(); i++) {
|
|
|
- curr_folder += folders[i];
|
|
|
+ for (auto const& folder : folders) {
|
|
|
+ curr_folder += folder;
|
|
|
std::map<std::string, cmXCodeObject*>::iterator i_folder =
|
|
|
this->GroupNameMap.find(curr_folder);
|
|
|
// Create new folder
|
|
|
if (i_folder == this->GroupNameMap.end()) {
|
|
|
- cmXCodeObject* group = this->CreatePBXGroup(tgroup, folders[i]);
|
|
|
+ cmXCodeObject* group = this->CreatePBXGroup(tgroup, folder);
|
|
|
this->GroupNameMap[curr_folder] = group;
|
|
|
tgroup = group;
|
|
|
} else {
|
|
|
@@ -2854,10 +2814,10 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
|
|
|
cmXCodeObject* group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
|
|
|
group->AddAttribute("COPY_PHASE_STRIP", this->CreateString("NO"));
|
|
|
cmXCodeObject* listObjs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
|
|
- for (unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) {
|
|
|
+ for (auto& CurrentConfigurationType : this->CurrentConfigurationTypes) {
|
|
|
cmXCodeObject* buildStyle =
|
|
|
this->CreateObject(cmXCodeObject::PBXBuildStyle);
|
|
|
- const char* name = this->CurrentConfigurationTypes[i].c_str();
|
|
|
+ const char* name = CurrentConfigurationType.c_str();
|
|
|
buildStyle->AddAttribute("name", this->CreateString(name));
|
|
|
buildStyle->SetComment(name);
|
|
|
cmXCodeObject* sgroup = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
|
|
|
@@ -2939,8 +2899,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
|
|
|
config->AddAttribute("name", this->CreateString(name));
|
|
|
configs.push_back(std::make_pair(name, config));
|
|
|
}
|
|
|
- for (Configs::iterator c = configs.begin(); c != configs.end(); ++c) {
|
|
|
- buildConfigurations->AddObject(c->second);
|
|
|
+ for (auto& config : configs) {
|
|
|
+ buildConfigurations->AddObject(config.second);
|
|
|
}
|
|
|
configlist->AddAttribute("buildConfigurations", buildConfigurations);
|
|
|
|
|
|
@@ -2998,7 +2958,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
|
|
|
symroot += "/build";
|
|
|
buildSettings->AddAttribute("SYMROOT", this->CreateString(symroot));
|
|
|
|
|
|
- for (Configs::iterator i = configs.begin(); i != configs.end(); ++i) {
|
|
|
+ for (auto& config : configs) {
|
|
|
cmXCodeObject* buildSettingsForCfg = this->CreateFlatClone(buildSettings);
|
|
|
|
|
|
// Put this last so it can override existing settings
|
|
|
@@ -3008,43 +2968,38 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
|
|
|
d != vars.end(); ++d) {
|
|
|
if (d->find("CMAKE_XCODE_ATTRIBUTE_") == 0) {
|
|
|
std::string attribute = d->substr(22);
|
|
|
- this->FilterConfigurationAttribute(i->first, attribute);
|
|
|
+ this->FilterConfigurationAttribute(config.first, attribute);
|
|
|
if (!attribute.empty()) {
|
|
|
cmGeneratorExpression ge;
|
|
|
std::string processed =
|
|
|
ge.Parse(this->CurrentMakefile->GetDefinition(*d))
|
|
|
- ->Evaluate(this->CurrentLocalGenerator, i->first);
|
|
|
+ ->Evaluate(this->CurrentLocalGenerator, config.first);
|
|
|
buildSettingsForCfg->AddAttribute(attribute,
|
|
|
this->CreateString(processed));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// store per-config buildSettings into configuration object
|
|
|
- i->second->AddAttribute("buildSettings", buildSettingsForCfg);
|
|
|
+ config.second->AddAttribute("buildSettings", buildSettingsForCfg);
|
|
|
}
|
|
|
|
|
|
this->RootObject->AddAttribute("buildConfigurationList",
|
|
|
this->CreateObjectReference(configlist));
|
|
|
|
|
|
std::vector<cmXCodeObject*> targets;
|
|
|
- for (std::vector<cmLocalGenerator*>::iterator i = generators.begin();
|
|
|
- i != generators.end(); ++i) {
|
|
|
- if (!this->CreateXCodeTargets(*i, targets)) {
|
|
|
+ for (auto& generator : generators) {
|
|
|
+ if (!this->CreateXCodeTargets(generator, targets)) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
// loop over all targets and add link and depend info
|
|
|
- for (std::vector<cmXCodeObject*>::iterator i = targets.begin();
|
|
|
- i != targets.end(); ++i) {
|
|
|
- cmXCodeObject* t = *i;
|
|
|
+ for (auto t : targets) {
|
|
|
this->AddDependAndLinkInformation(t);
|
|
|
}
|
|
|
this->CreateXCodeDependHackTarget(targets);
|
|
|
// now add all targets to the root object
|
|
|
cmXCodeObject* allTargets = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
|
|
- for (std::vector<cmXCodeObject*>::iterator i = targets.begin();
|
|
|
- i != targets.end(); ++i) {
|
|
|
- cmXCodeObject* t = *i;
|
|
|
+ for (auto t : targets) {
|
|
|
allTargets->AddObject(t);
|
|
|
cmXCodeObject* productRef = t->GetObject("productReference");
|
|
|
if (productRef) {
|
|
|
@@ -3137,9 +3092,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
|
|
|
this->CurrentConfigurationTypes.begin();
|
|
|
ct != this->CurrentConfigurationTypes.end(); ++ct) {
|
|
|
std::string configName = *ct;
|
|
|
- for (std::vector<cmXCodeObject*>::iterator i = targets.begin();
|
|
|
- i != targets.end(); ++i) {
|
|
|
- cmXCodeObject* target = *i;
|
|
|
+ for (auto target : targets) {
|
|
|
cmGeneratorTarget* gt = target->GetTarget();
|
|
|
|
|
|
if (gt->GetType() == cmStateEnums::EXECUTABLE ||
|
|
|
@@ -3164,9 +3117,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
|
|
|
target->GetDependTargets().find(*ct);
|
|
|
if (y != target->GetDependTargets().end()) {
|
|
|
std::vector<std::string> const& deptgts = y->second;
|
|
|
- for (std::vector<std::string>::const_iterator d = deptgts.begin();
|
|
|
- d != deptgts.end(); ++d) {
|
|
|
- makefileStream << this->PostBuildMakeTarget(*d, *ct) << ": "
|
|
|
+ for (auto const& deptgt : deptgts) {
|
|
|
+ makefileStream << this->PostBuildMakeTarget(deptgt, *ct) << ": "
|
|
|
<< trel << "\n";
|
|
|
}
|
|
|
}
|
|
|
@@ -3188,9 +3140,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
|
|
|
target->GetDependLibraries().find(*ct);
|
|
|
if (x != target->GetDependLibraries().end()) {
|
|
|
std::vector<std::string> const& deplibs = x->second;
|
|
|
- for (std::vector<std::string>::const_iterator d = deplibs.begin();
|
|
|
- d != deplibs.end(); ++d) {
|
|
|
- std::string file = this->ConvertToRelativeForMake(d->c_str());
|
|
|
+ for (auto const& deplib : deplibs) {
|
|
|
+ std::string file = this->ConvertToRelativeForMake(deplib.c_str());
|
|
|
makefileStream << "\\\n\t" << file;
|
|
|
dummyRules.insert(file);
|
|
|
}
|
|
|
@@ -3222,11 +3173,9 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
|
|
|
if (this->Architectures.size() > 1) {
|
|
|
std::string universal = this->GetObjectsNormalDirectory(
|
|
|
this->CurrentProject, configName, gt);
|
|
|
- for (std::vector<std::string>::iterator arch =
|
|
|
- this->Architectures.begin();
|
|
|
- arch != this->Architectures.end(); ++arch) {
|
|
|
+ for (auto& architecture : this->Architectures) {
|
|
|
std::string universalFile = universal;
|
|
|
- universalFile += *arch;
|
|
|
+ universalFile += architecture;
|
|
|
universalFile += "/";
|
|
|
universalFile += gt->GetFullName(configName);
|
|
|
makefileStream << "\t/bin/rm -f "
|
|
|
@@ -3243,9 +3192,8 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
|
|
|
makefileStream << "\n\n"
|
|
|
<< "# For each target create a dummy rule"
|
|
|
<< "so the target does not have to exist\n";
|
|
|
- for (std::set<std::string>::const_iterator it = dummyRules.begin();
|
|
|
- it != dummyRules.end(); ++it) {
|
|
|
- makefileStream << *it << ":\n";
|
|
|
+ for (auto const& dummyRule : dummyRules) {
|
|
|
+ makefileStream << dummyRule << ":\n";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -3256,9 +3204,8 @@ void cmGlobalXCodeGenerator::OutputXCodeProject(
|
|
|
return;
|
|
|
}
|
|
|
// Skip local generators that are excluded from this project.
|
|
|
- for (std::vector<cmLocalGenerator*>::iterator g = generators.begin();
|
|
|
- g != generators.end(); ++g) {
|
|
|
- if (this->IsExcluded(root, *g)) {
|
|
|
+ for (auto& generator : generators) {
|
|
|
+ if (this->IsExcluded(root, generator)) {
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
@@ -3511,11 +3458,10 @@ void cmGlobalXCodeGenerator::AppendDefines(
|
|
|
{
|
|
|
// GCC_PREPROCESSOR_DEFINITIONS is a space-separated list of definitions.
|
|
|
std::string def;
|
|
|
- for (std::vector<std::string>::const_iterator di = defines.begin();
|
|
|
- di != defines.end(); ++di) {
|
|
|
+ for (auto const& define : defines) {
|
|
|
// Start with -D if requested.
|
|
|
def = dflag ? "-D" : "";
|
|
|
- def += *di;
|
|
|
+ def += define;
|
|
|
|
|
|
// Append the flag with needed escapes.
|
|
|
std::string tmp;
|