From 8c60c49ae2ac24915931708435f632e66b713f4b Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 1 Sep 2020 14:05:47 -0400 Subject: Xcode: Refactor custom command dependency expansion Compute and store the "real" dependencies earlier. --- Source/cmGlobalXCodeGenerator.cxx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 9f8e331..c6edfad 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1839,6 +1839,15 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( for (auto const& command : commands) { cmCustomCommandGenerator ccg(command, configName, this->CurrentLocalGenerator); + std::vector realDepends; + realDepends.reserve(ccg.GetDepends().size()); + for (auto const& d : ccg.GetDepends()) { + std::string dep; + if (this->CurrentLocalGenerator->GetRealDependency(d, configName, dep)) { + realDepends.emplace_back(std::move(dep)); + } + } + if (ccg.GetNumberOfCommands() > 0) { makefileStream << "\n"; const std::vector& outputs = ccg.GetOutputs(); @@ -1854,12 +1863,8 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( // There are no outputs. Use the generated force rule name. makefileStream << tname[&ccg.GetCC()] << ": "; } - for (auto const& d : ccg.GetDepends()) { - std::string dep; - if (this->CurrentLocalGenerator->GetRealDependency(d, configName, - dep)) { - makefileStream << "\\\n" << this->ConvertToRelativeForMake(dep); - } + for (auto const& dep : realDepends) { + makefileStream << "\\\n" << this->ConvertToRelativeForMake(dep); } makefileStream << "\n"; -- cgit v0.12