1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-20 04:24:36 +08:00

Xcode: Refactor custom command dependency expansion

Compute and store the "real" dependencies earlier.
This commit is contained in:
Brad King
2020-09-01 14:05:47 -04:00
parent 8f73ff0c37
commit 8c60c49ae2

View File

@@ -1839,6 +1839,15 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
for (auto const& command : commands) {
cmCustomCommandGenerator ccg(command, configName,
this->CurrentLocalGenerator);
std::vector<std::string> 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<std::string>& outputs = ccg.GetOutputs();
@@ -1854,13 +1863,9 @@ 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)) {
for (auto const& dep : realDepends) {
makefileStream << "\\\n" << this->ConvertToRelativeForMake(dep);
}
}
makefileStream << "\n";
if (const char* comment = ccg.GetComment()) {