summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-02-19 21:13:51 (GMT)
committerBrad King <brad.king@kitware.com>2013-02-19 21:45:58 (GMT)
commitb0051404510e8570b16615ed927a88d07c0ff4e8 (patch)
treec35b3b0b2787bde8c06260871f7b2efbcab93afc /Source/cmGlobalXCodeGenerator.cxx
parent781ea6d1ca03a11a40a92363e99637a6f20a6a69 (diff)
downloadCMake-b0051404510e8570b16615ed927a88d07c0ff4e8.zip
CMake-b0051404510e8570b16615ed927a88d07c0ff4e8.tar.gz
CMake-b0051404510e8570b16615ed927a88d07c0ff4e8.tar.bz2
Xcode: Each target dependency edge needs a unique object (#13935)
Generate a unique PBXTargetDependency and PBXContainerItemProxy for every edge in the dependency graph as required by the Xcode format. Xcode only accidentally loads project files that re-use the same PBXTargetDependency for every edge leading to a single target. If one is removed by hand in the IDE then Xcode may crash due to dangling references from the others. Since cmGlobalXCodeGenerator::AddDependTarget is called exactly once for every edge in the target dependency graph we do not need to keep track of which edges have been visited to avoid generating duplicates.
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx42
1 files changed, 19 insertions, 23 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index fb8eafc..d836290 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2517,29 +2517,25 @@ std::string cmGlobalXCodeGenerator::GetOrCreateId(const char* name,
void cmGlobalXCodeGenerator::AddDependTarget(cmXCodeObject* target,
cmXCodeObject* dependTarget)
{
- cmXCodeObject* targetdep = dependTarget->GetPBXTargetDependency();
- if(!targetdep)
- {
- cmXCodeObject* container =
- this->CreateObject(cmXCodeObject::PBXContainerItemProxy);
- container->SetComment("PBXContainerItemProxy");
- container->AddAttribute("containerPortal",
- this->CreateObjectReference(this->RootObject));
- container->AddAttribute("proxyType", this->CreateString("1"));
- container->AddAttribute("remoteGlobalIDString",
- this->CreateObjectReference(dependTarget));
- container->AddAttribute("remoteInfo",
- this->CreateString(
- dependTarget->GetTarget()->GetName()));
- targetdep =
- this->CreateObject(cmXCodeObject::PBXTargetDependency);
- targetdep->SetComment("PBXTargetDependency");
- targetdep->AddAttribute("target",
- this->CreateObjectReference(dependTarget));
- targetdep->AddAttribute("targetProxy",
- this->CreateObjectReference(container));
- dependTarget->SetPBXTargetDependency(targetdep);
- }
+ // This is called once for every edge in the target dependency graph.
+ cmXCodeObject* container =
+ this->CreateObject(cmXCodeObject::PBXContainerItemProxy);
+ container->SetComment("PBXContainerItemProxy");
+ container->AddAttribute("containerPortal",
+ this->CreateObjectReference(this->RootObject));
+ container->AddAttribute("proxyType", this->CreateString("1"));
+ container->AddAttribute("remoteGlobalIDString",
+ this->CreateObjectReference(dependTarget));
+ container->AddAttribute("remoteInfo",
+ this->CreateString(
+ dependTarget->GetTarget()->GetName()));
+ cmXCodeObject* targetdep =
+ this->CreateObject(cmXCodeObject::PBXTargetDependency);
+ targetdep->SetComment("PBXTargetDependency");
+ targetdep->AddAttribute("target",
+ this->CreateObjectReference(dependTarget));
+ targetdep->AddAttribute("targetProxy",
+ this->CreateObjectReference(container));
cmXCodeObject* depends = target->GetObject("dependencies");
if(!depends)