summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorGregor Jasny <gjasny@googlemail.com>2017-02-18 18:23:59 +0100
committerGregor Jasny <gjasny@googlemail.com>2017-02-22 17:05:17 +0100
commit9293e57d9cef75a5abb6f28d5bf712106471a137 (patch)
treed3fa405c0ec5d12d15242d748b9cd55644a9c3fa /Source
parent33a1d727d5aafeaa0d9e729119d7d43ea9fcb370 (diff)
downloadcmake-9293e57d9cef75a5abb6f28d5bf712106471a137.tar.gz
Xcode: Collect dummy rules during iteration and emit afterwards
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx37
1 files changed, 13 insertions, 24 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 5029a947a4..9d5c99efae 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -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(