mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
committed by
Brad King
parent
53716f6bfd
commit
4ca5e5480a
@@ -4551,6 +4551,21 @@ bool cmGlobalXCodeGenerator::CreateGroups(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sort all children of each target group by name alphabetically.
|
||||||
|
auto const getName = [](cmXCodeObject* obj) -> cm::string_view {
|
||||||
|
cmXCodeObject* name = obj->GetAttribute("name");
|
||||||
|
return name ? name->GetString() : cm::string_view{ ""_s };
|
||||||
|
};
|
||||||
|
for (auto& group : this->TargetGroup) {
|
||||||
|
if (cmXCodeObject* children = group.second->GetAttribute("children")) {
|
||||||
|
children->SortObjectList(getName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Also sort the-top level group. Special groups like Products,
|
||||||
|
// Frameworks, and Resources are added later to the end of the list.
|
||||||
|
this->MainGroupChildren->SortObjectList(getName);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -163,6 +163,15 @@ public:
|
|||||||
void SetComment(std::string const& c) { this->Comment = c; }
|
void SetComment(std::string const& c) { this->Comment = c; }
|
||||||
static void PrintString(std::ostream& os, std::string const& String);
|
static void PrintString(std::ostream& os, std::string const& String);
|
||||||
|
|
||||||
|
template <typename Proj>
|
||||||
|
void SortObjectList(Proj projector)
|
||||||
|
{
|
||||||
|
std::sort(this->List.begin(), this->List.end(),
|
||||||
|
[&projector](cmXCodeObject* a, cmXCodeObject* b) {
|
||||||
|
return projector(a) < projector(b);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void PrintString(std::ostream& os) const;
|
void PrintString(std::ostream& os) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user