summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-07-19 15:54:10 (GMT)
committerBrad King <brad.king@kitware.com>2018-07-19 17:20:28 (GMT)
commit0bad9eba46f6899a4c59431e7136a868d0003854 (patch)
treec4bc313d654bf54e0ed8ad0ff00d887c1ce3a8ab /Source/cmGlobalXCodeGenerator.cxx
parentd0de296e50c08a2abc4d5d108fb3030a150f0574 (diff)
downloadCMake-0bad9eba46f6899a4c59431e7136a868d0003854.zip
CMake-0bad9eba46f6899a4c59431e7136a868d0003854.tar.gz
CMake-0bad9eba46f6899a4c59431e7136a868d0003854.tar.bz2
Xcode: Refactor storage of ordered list of targets
Sort the resulting Xcode object list so that the actual order of generation does not matter.
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx18
1 files changed, 8 insertions, 10 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 7d07860..df4e507 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1065,15 +1065,17 @@ struct cmSourceFilePathCompare
struct cmCompareTargets
{
- bool operator()(std::string const& a, std::string const& b) const
+ bool operator()(cmXCodeObject* l, cmXCodeObject* r) const
{
+ std::string const& a = l->GetTarget()->GetName();
+ std::string const& b = r->GetTarget()->GetName();
if (a == "ALL_BUILD") {
return true;
}
if (b == "ALL_BUILD") {
return false;
}
- return strcmp(a.c_str(), b.c_str()) < 0;
+ return a < b;
}
};
@@ -1081,18 +1083,14 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
cmLocalGenerator* gen, std::vector<cmXCodeObject*>& targets)
{
this->SetCurrentLocalGenerator(gen);
- typedef std::map<std::string, cmGeneratorTarget*, cmCompareTargets>
- cmSortedTargets;
- cmSortedTargets sortedTargets;
- for (auto tgt : this->CurrentLocalGenerator->GetGeneratorTargets()) {
- sortedTargets[tgt->GetName()] = tgt;
- }
- for (auto& sortedTarget : sortedTargets) {
- cmGeneratorTarget* gtgt = sortedTarget.second;
+ std::vector<cmGeneratorTarget*> const& gts =
+ this->CurrentLocalGenerator->GetGeneratorTargets();
+ for (auto gtgt : gts) {
if (!this->CreateXCodeTarget(gtgt, targets)) {
return false;
}
}
+ std::sort(targets.begin(), targets.end(), cmCompareTargets());
return true;
}