ENH: Use improved target dependencies for Xcode
In cmGlobalGenerator we use cmComputeTargetDepends to construct a safe, non-circular set of inter-target dependencies. This change enables use of the results by the Xcode generator. It also removes a lot of old code and another use of the old-style linking logic. See issue #7652.
This commit is contained in:
parent
a4d679af90
commit
76c5697a16
|
@ -2047,70 +2047,12 @@ void cmGlobalXCodeGenerator
|
|||
}
|
||||
|
||||
// Add dependencies on other CMake targets.
|
||||
{
|
||||
// Keep track of dependencies already listed.
|
||||
std::set<cmStdString> emitted;
|
||||
|
||||
// A target should not depend on itself.
|
||||
emitted.insert(cmtarget->GetName());
|
||||
|
||||
// Loop over all library dependencies.
|
||||
const cmTarget::LinkLibraryVectorType& tlibs =
|
||||
cmtarget->GetLinkLibraries();
|
||||
for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin();
|
||||
lib != tlibs.end(); ++lib)
|
||||
TargetDependSet const& deps = this->GetTargetDirectDepends(*cmtarget);
|
||||
for(TargetDependSet::const_iterator i = deps.begin(); i != deps.end(); ++i)
|
||||
{
|
||||
// Don't emit the same library twice for this target.
|
||||
if(emitted.insert(lib->first).second)
|
||||
if(cmXCodeObject* dptarget = this->FindXCodeTarget(*i))
|
||||
{
|
||||
// Add this dependency.
|
||||
cmTarget* t = this->FindTarget(this->CurrentProject.c_str(),
|
||||
lib->first.c_str());
|
||||
cmXCodeObject* dptarget = this->FindXCodeTarget(t);
|
||||
if(dptarget)
|
||||
{
|
||||
this->AddDependTarget(target, dptarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// write utility dependencies.
|
||||
for(std::set<cmStdString>::const_iterator i
|
||||
= cmtarget->GetUtilities().begin();
|
||||
i != cmtarget->GetUtilities().end(); ++i)
|
||||
{
|
||||
cmTarget* t = this->FindTarget(this->CurrentProject.c_str(),
|
||||
i->c_str());
|
||||
// if the target is in this project then make target depend
|
||||
// on it. It may not be in this project if this is a sub
|
||||
// project from the top.
|
||||
if(t)
|
||||
{
|
||||
cmXCodeObject* dptarget = this->FindXCodeTarget(t);
|
||||
if(dptarget)
|
||||
{
|
||||
this->AddDependTarget(target, dptarget);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string m = "Error Utility: ";
|
||||
m += i->c_str();
|
||||
m += "\n";
|
||||
m += "cmtarget ";
|
||||
if(t)
|
||||
{
|
||||
m += t->GetName();
|
||||
}
|
||||
m += "\n";
|
||||
m += "Is on the target ";
|
||||
m += cmtarget->GetName();
|
||||
m += "\n";
|
||||
m += "But it has no xcode target created yet??\n";
|
||||
m += "Current project is ";
|
||||
m += this->CurrentProject.c_str();
|
||||
cmSystemTools::Error(m.c_str());
|
||||
}
|
||||
this->AddDependTarget(target, dptarget);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue