Xcode: Process targets in depth-first order during generation

The Xcode 10 "new build system" requires more strict handling of custom
commands.  It may need a fix similar to what commit v3.12.0-rc1~171^2
(VS: Generate a custom command only in the least dependent target,
2018-03-23) did for VS.  Prepare for this by generating targets within
each local generator in dependency order.

Issue: #18070
This commit is contained in:
Brad King 2018-07-19 12:47:45 -04:00
parent 0bad9eba46
commit fb45559e09

View File

@ -1083,8 +1083,12 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
cmLocalGenerator* gen, std::vector<cmXCodeObject*>& targets)
{
this->SetCurrentLocalGenerator(gen);
std::vector<cmGeneratorTarget*> const& gts =
std::vector<cmGeneratorTarget*> gts =
this->CurrentLocalGenerator->GetGeneratorTargets();
std::sort(gts.begin(), gts.end(),
[this](cmGeneratorTarget const* l, cmGeneratorTarget const* r) {
return this->TargetOrderIndex[l] < this->TargetOrderIndex[r];
});
for (auto gtgt : gts) {
if (!this->CreateXCodeTarget(gtgt, targets)) {
return false;