summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-03 18:51:55 (GMT)
committerBrad King <brad.king@kitware.com>2020-09-04 13:31:06 (GMT)
commitc4e296a60910c641a07695d1a9782912bce45d5c (patch)
tree53b0305890b4ab3d2fda351c56494425ad67ffd9 /Source/cmGlobalXCodeGenerator.cxx
parentb03bc81d62c68c664990bbb4b8b92d23fe9673a8 (diff)
downloadCMake-c4e296a60910c641a07695d1a9782912bce45d5c.zip
CMake-c4e296a60910c641a07695d1a9782912bce45d5c.tar.gz
CMake-c4e296a60910c641a07695d1a9782912bce45d5c.tar.bz2
cmGlobalGenerator: Compute a global target ordering respecting dependencies
Move this up from `cmGlobalXCodeGenerator`. It will be useful for all generators.
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx41
1 files changed, 2 insertions, 39 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index dbc95e6..2f27128 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -424,37 +424,6 @@ void cmGlobalXCodeGenerator::AddExtraIDETargets()
}
}
-void cmGlobalXCodeGenerator::ComputeTargetOrder()
-{
- size_t index = 0;
- auto const& lgens = this->GetLocalGenerators();
- for (auto const& lgen : lgens) {
- const auto& targets = lgen->GetGeneratorTargets();
- for (const auto& gt : targets) {
- this->ComputeTargetOrder(gt.get(), index);
- }
- }
- assert(index == this->TargetOrderIndex.size());
-}
-
-void cmGlobalXCodeGenerator::ComputeTargetOrder(cmGeneratorTarget const* gt,
- size_t& index)
-{
- std::map<cmGeneratorTarget const*, size_t>::value_type value(gt, 0);
- auto insertion = this->TargetOrderIndex.insert(value);
- if (!insertion.second) {
- return;
- }
- auto entry = insertion.first;
-
- auto& deps = this->GetTargetDirectDepends(gt);
- for (auto& d : deps) {
- this->ComputeTargetOrder(d, index);
- }
-
- entry->second = index++;
-}
-
void cmGlobalXCodeGenerator::Generate()
{
this->cmGlobalGenerator::Generate();
@@ -462,8 +431,6 @@ void cmGlobalXCodeGenerator::Generate()
return;
}
- this->ComputeTargetOrder();
-
for (auto keyVal : this->ProjectMap) {
cmLocalGenerator* root = keyVal.second[0];
@@ -1243,12 +1210,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
cmLocalGenerator* gen, std::vector<cmXCodeObject*>& targets)
{
this->SetCurrentLocalGenerator(gen);
- std::vector<cmGeneratorTarget*> gts;
- cm::append(gts, this->CurrentLocalGenerator->GetGeneratorTargets());
- std::sort(gts.begin(), gts.end(),
- [this](cmGeneratorTarget const* l, cmGeneratorTarget const* r) {
- return this->TargetOrderIndex[l] < this->TargetOrderIndex[r];
- });
+ std::vector<cmGeneratorTarget*> gts =
+ this->GetLocalGeneratorTargetsInOrder(gen);
for (auto gtgt : gts) {
if (!this->CreateXCodeTarget(gtgt, targets)) {
return false;