summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorGregor Jasny <gjasny@googlemail.com>2017-02-18 17:41:03 (GMT)
committerGregor Jasny <gjasny@googlemail.com>2017-02-22 16:05:18 (GMT)
commite80ac953035703dde6e03e2c32ba9fded8c69f2a (patch)
tree0466b89fa5a44c0098fbf120cc4a119e912804d9 /Source
parent9293e57d9cef75a5abb6f28d5bf712106471a137 (diff)
downloadCMake-e80ac953035703dde6e03e2c32ba9fded8c69f2a.zip
CMake-e80ac953035703dde6e03e2c32ba9fded8c69f2a.tar.gz
CMake-e80ac953035703dde6e03e2c32ba9fded8c69f2a.tar.bz2
Xcode: Record dependency information also for object libraries
Xcode seems to have troubles to track target dependecies to object files. This may lead to stale targets as reported in issue #16615. As a work-around the pre-Xcode 5 dependecy tracker hack with post-build make files is extended to also take object libraries into account.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx38
1 files changed, 30 insertions, 8 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 9d5c99e..0a9c7b8 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -477,8 +477,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
// things are up-to-date
if (!makeHelper.empty() &&
(target->GetType() == cmStateEnums::EXECUTABLE ||
- // Nope - no post-build for OBJECT_LIRBRARY
- // target->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+ target->GetType() == cmStateEnums::OBJECT_LIBRARY ||
target->GetType() == cmStateEnums::STATIC_LIBRARY ||
target->GetType() == cmStateEnums::SHARED_LIBRARY ||
target->GetType() == cmStateEnums::MODULE_LIBRARY)) {
@@ -3130,10 +3129,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
cmXCodeObject* t = *i;
this->AddDependAndLinkInformation(t);
}
- if (this->XcodeVersion < 50) {
- // now create xcode depend hack makefile
- this->CreateXCodeDependHackTarget(targets);
- }
+ this->CreateXCodeDependHackTarget(targets);
// now add all targets to the root object
cmXCodeObject* allTargets = this->CreateObject(cmXCodeObject::OBJECT_LIST);
for (std::vector<cmXCodeObject*>::iterator i = targets.begin();
@@ -3205,8 +3201,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
cmGeneratorTarget* gt = target->GetTarget();
if (gt->GetType() == cmStateEnums::EXECUTABLE ||
- // Nope - no post-build for OBJECT_LIRBRARY
- // gt->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+ gt->GetType() == cmStateEnums::OBJECT_LIBRARY ||
gt->GetType() == cmStateEnums::STATIC_LIBRARY ||
gt->GetType() == cmStateEnums::SHARED_LIBRARY ||
gt->GetType() == cmStateEnums::MODULE_LIBRARY) {
@@ -3216,6 +3211,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
}
if (gt->GetType() == cmStateEnums::EXECUTABLE ||
+ gt->GetType() == cmStateEnums::STATIC_LIBRARY ||
gt->GetType() == cmStateEnums::SHARED_LIBRARY ||
gt->GetType() == cmStateEnums::MODULE_LIBRARY) {
std::string tfull = gt->GetFullPath(configName);
@@ -3233,6 +3229,15 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
}
}
+ std::vector<cmGeneratorTarget*> objlibs;
+ gt->GetObjectLibrariesCMP0026(objlibs);
+ for (std::vector<cmGeneratorTarget*>::const_iterator it =
+ objlibs.begin();
+ it != objlibs.end(); ++it) {
+ makefileStream << this->PostBuildMakeTarget((*it)->GetName(), *ct)
+ << ": " << trel << "\n";
+ }
+
// Create a rule for this target.
makefileStream << trel << ":";
@@ -3248,6 +3253,23 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
dummyRules.insert(file);
}
}
+
+ for (std::vector<cmGeneratorTarget*>::const_iterator it =
+ objlibs.begin();
+ it != objlibs.end(); ++it) {
+
+ const std::string objLibName = (*it)->GetName();
+ std::string d = this->GetObjectsNormalDirectory(this->CurrentProject,
+ configName, *it);
+ d += "lib";
+ d += objLibName;
+ d += ".a";
+
+ std::string dependency = this->ConvertToRelativeForMake(d.c_str());
+ makefileStream << "\\\n\t" << dependency;
+ dummyRules.insert(dependency);
+ }
+
// Write the action to remove the target if it is out of date.
makefileStream << "\n";
makefileStream << "\t/bin/rm -f "