Xcode: Fix early termination on per-config source file error
In commit v3.1.0-rc1~687^2~4 (cmTarget: Make the source files depend on the config, 2014-02-13) an early termination case was added to the Xcode generator. Fix handling of this case to actually abort all the generation steps. Otherwise some of the later steps are attempted without the preconditions normally established by earlier steps, possibly leading to a crash.
This commit is contained in:
parent
c118816d44
commit
c0ff542c58
|
@ -966,7 +966,7 @@ struct cmSourceFilePathCompare
|
|||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
bool
|
||||
cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
|
||||
std::vector<cmXCodeObject*>&
|
||||
targets)
|
||||
|
@ -992,7 +992,12 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
|
|||
if(cmtarget.GetType() == cmTarget::UTILITY ||
|
||||
cmtarget.GetType() == cmTarget::GLOBAL_TARGET)
|
||||
{
|
||||
targets.push_back(this->CreateUtilityTarget(cmtarget));
|
||||
cmXCodeObject* t = this->CreateUtilityTarget(cmtarget);
|
||||
if (!t)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
targets.push_back(t);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1000,7 +1005,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
|
|||
std::vector<cmSourceFile*> classes;
|
||||
if (!cmtarget.GetConfigCommonSourceFiles(classes))
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare());
|
||||
|
||||
|
@ -1227,6 +1232,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
|
|||
|
||||
targets.push_back(this->CreateXCodeTarget(cmtarget, buildPhases));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -2940,7 +2946,7 @@ void cmGlobalXCodeGenerator
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
|
||||
bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
|
||||
std::vector<cmLocalGenerator*>&
|
||||
generators)
|
||||
{
|
||||
|
@ -2983,7 +2989,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
|
|||
std::vector<cmSourceFile*> classes;
|
||||
if (!cmtarget.GetConfigCommonSourceFiles(classes))
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
// Put cmSourceFile instances in proper groups:
|
||||
for(std::vector<cmSourceFile*>::const_iterator s = classes.begin();
|
||||
|
@ -3016,6 +3022,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
|
|||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
cmXCodeObject *cmGlobalXCodeGenerator
|
||||
|
@ -3136,7 +3143,7 @@ cmXCodeObject* cmGlobalXCodeGenerator
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmGlobalXCodeGenerator
|
||||
bool cmGlobalXCodeGenerator
|
||||
::CreateXCodeObjects(cmLocalGenerator* root,
|
||||
std::vector<cmLocalGenerator*>&
|
||||
generators)
|
||||
|
@ -3217,7 +3224,10 @@ void cmGlobalXCodeGenerator
|
|||
this->MainGroupChildren->AddObject(resourcesGroup);
|
||||
|
||||
// now create the cmake groups
|
||||
this->CreateGroups(root, generators);
|
||||
if (!this->CreateGroups(root, generators))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
cmXCodeObject* productGroup = this->CreateObject(cmXCodeObject::PBXGroup);
|
||||
productGroup->AddAttribute("name", this->CreateString("Products"));
|
||||
|
@ -3417,7 +3427,10 @@ void cmGlobalXCodeGenerator
|
|||
{
|
||||
if(!this->IsExcluded(root, *i))
|
||||
{
|
||||
this->CreateXCodeTargets(*i, targets);
|
||||
if (!this->CreateXCodeTargets(*i, targets))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// loop over all targets and add link and depend info
|
||||
|
@ -3446,6 +3459,7 @@ void cmGlobalXCodeGenerator
|
|||
}
|
||||
}
|
||||
this->RootObject->AddAttribute("targets", allTargets);
|
||||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -3632,8 +3646,10 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
|
|||
}
|
||||
}
|
||||
|
||||
this->CreateXCodeObjects(root,
|
||||
generators);
|
||||
if (!this->CreateXCodeObjects(root, generators))
|
||||
{
|
||||
return;
|
||||
}
|
||||
std::string xcodeDir = root->GetMakefile()->GetStartOutputDirectory();
|
||||
xcodeDir += "/";
|
||||
xcodeDir += root->GetMakefile()->GetProjectName();
|
||||
|
|
|
@ -91,7 +91,7 @@ private:
|
|||
cmSourceGroup* sg);
|
||||
cmXCodeObject* CreatePBXGroup(cmXCodeObject *parent,
|
||||
std::string name);
|
||||
void CreateGroups(cmLocalGenerator* root,
|
||||
bool CreateGroups(cmLocalGenerator* root,
|
||||
std::vector<cmLocalGenerator*>&
|
||||
generators);
|
||||
std::string XCodeEscapePath(const char* p);
|
||||
|
@ -151,7 +151,7 @@ private:
|
|||
std::string ExtractFlag(const char* flag, std::string& flags);
|
||||
// delete all objects in the this->XCodeObjects vector.
|
||||
void ClearXCodeObjects();
|
||||
void CreateXCodeObjects(cmLocalGenerator* root,
|
||||
bool CreateXCodeObjects(cmLocalGenerator* root,
|
||||
std::vector<cmLocalGenerator*>& generators);
|
||||
void OutputXCodeProject(cmLocalGenerator* root,
|
||||
std::vector<cmLocalGenerator*>& generators);
|
||||
|
@ -170,7 +170,7 @@ private:
|
|||
cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen,
|
||||
cmSourceFile* sf,
|
||||
cmTarget& cmtarget);
|
||||
void CreateXCodeTargets(cmLocalGenerator* gen,
|
||||
bool CreateXCodeTargets(cmLocalGenerator* gen,
|
||||
std::vector<cmXCodeObject*>&);
|
||||
bool IsHeaderFile(cmSourceFile*);
|
||||
void AddDependTarget(cmXCodeObject* target,
|
||||
|
|
Loading…
Reference in New Issue