Xcode: Honor $<TARGET_OBJECTS:...> source expressions

Add objects from object libraries referenced using this syntax to the
set of objects linked in a target.
This commit is contained in:
David Cole 2012-03-16 10:14:33 -04:00 committed by Brad King
parent 020ba38775
commit 63d1be8b00
1 changed files with 33 additions and 0 deletions

View File

@ -295,6 +295,10 @@ void cmGlobalXCodeGenerator::Generate()
}
this->ForceLinkerLanguages();
this->cmGlobalGenerator::Generate();
if(cmSystemTools::GetErrorOccuredFlag())
{
return;
}
for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
{
cmLocalGenerator* root = it->second[0];
@ -945,6 +949,20 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
}
}
// Add object library contents as external objects. (Equivalent to
// the externalObjFiles above, except each one is not a cmSourceFile
// within the target.)
std::vector<std::string> objs;
this->GetGeneratorTarget(&cmtarget)->UseObjectLibraries(objs);
for(std::vector<std::string>::const_iterator
oi = objs.begin(); oi != objs.end(); ++oi)
{
std::string obj = *oi;
cmXCodeObject* xsf =
this->CreateXCodeSourceFileFromPath(obj, cmtarget, "");
externalObjFiles.push_back(xsf);
}
// some build phases only apply to bundles and/or frameworks
bool isFrameworkTarget = cmtarget.IsFrameworkOnApple();
bool isBundleTarget = cmtarget.GetPropertyAsBool("MACOSX_BUNDLE");
@ -2719,6 +2737,21 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
cmStdString key = GetGroupMapKey(cmtarget, sf);
this->GroupMap[key] = pbxgroup;
}
// Put OBJECT_LIBRARY objects in proper groups:
std::vector<std::string> objs;
this->GetGeneratorTarget(&cmtarget)->UseObjectLibraries(objs);
for(std::vector<std::string>::const_iterator
oi = objs.begin(); oi != objs.end(); ++oi)
{
std::string const& source = *oi;
cmSourceGroup& sourceGroup =
mf->FindSourceGroup(source.c_str(), sourceGroups);
cmXCodeObject* pbxgroup =
this->CreateOrGetPBXGroup(cmtarget, &sourceGroup);
cmStdString key = GetGroupMapKeyFromPath(cmtarget, source);
this->GroupMap[key] = pbxgroup;
}
}
}
}