Xcode: Collect dummy rules during iteration and emit afterwards

This commit is contained in:
Gregor Jasny
2017-02-18 18:23:59 +01:00
parent 33a1d727d5
commit 9293e57d9c

View File

@@ -3184,29 +3184,9 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
"default:\n"
"\techo \"Do not invoke directly\"\n"
"\n";
makefileStream
<< "# For each target create a dummy rule "
"so the target does not have to exist\n";
/* clang-format on */
std::set<std::string> emitted;
for (std::vector<cmXCodeObject*>::iterator i = targets.begin();
i != targets.end(); ++i) {
cmXCodeObject* target = *i;
std::map<std::string, cmXCodeObject::StringVec> const& deplibs =
target->GetDependLibraries();
for (std::map<std::string, cmXCodeObject::StringVec>::const_iterator ci =
deplibs.begin();
ci != deplibs.end(); ++ci) {
for (cmXCodeObject::StringVec::const_iterator d = ci->second.begin();
d != ci->second.end(); ++d) {
if (emitted.insert(*d).second) {
makefileStream << this->ConvertToRelativeForMake(d->c_str())
<< ":\n";
}
}
}
}
makefileStream << "\n\n";
std::set<std::string> dummyRules;
// Write rules to help Xcode relink things at the right time.
/* clang-format off */
@@ -3263,8 +3243,9 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
std::vector<std::string> const& deplibs = x->second;
for (std::vector<std::string>::const_iterator d = deplibs.begin();
d != deplibs.end(); ++d) {
makefileStream << "\\\n\t"
<< this->ConvertToRelativeForMake(d->c_str());
std::string file = this->ConvertToRelativeForMake(d->c_str());
makefileStream << "\\\n\t" << file;
dummyRules.insert(file);
}
}
// Write the action to remove the target if it is out of date.
@@ -3294,6 +3275,14 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
}
}
}
makefileStream << "\n\n"
<< "# For each target create a dummy rule"
<< "so the target does not have to exist\n";
for (std::set<std::string>::const_iterator it = dummyRules.begin();
it != dummyRules.end(); ++it) {
makefileStream << *it << ":\n";
}
}
void cmGlobalXCodeGenerator::OutputXCodeProject(