cmGlobalXCodeGenerator: Adopt pbxproj object id generation

This commit is contained in:
Brad King
2021-01-06 15:29:24 -05:00
parent 95e3ff2e88
commit d250b67722
6 changed files with 30 additions and 28 deletions

View File

@@ -40,7 +40,7 @@ cmXCodeObject::~cmXCodeObject()
this->Version = 15;
}
cmXCodeObject::cmXCodeObject(PBXType ptype, Type type)
cmXCodeObject::cmXCodeObject(PBXType ptype, Type type, std::string id)
{
this->Version = 15;
this->Target = nullptr;
@@ -48,27 +48,7 @@ cmXCodeObject::cmXCodeObject(PBXType ptype, Type type)
this->IsA = ptype;
if (type == OBJECT) {
// Set the Id of an Xcode object to a unique string for each instance.
// However the Xcode user file references certain Ids: for those cases,
// override the generated Id using SetId().
//
char cUuid[40] = { 0 };
CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);
CFStringRef s = CFUUIDCreateString(kCFAllocatorDefault, uuid);
CFStringGetCString(s, cUuid, sizeof(cUuid), kCFStringEncodingUTF8);
this->Id = cUuid;
CFRelease(s);
CFRelease(uuid);
} else {
this->Id =
"Temporary cmake object, should not be referred to in Xcode file";
}
cmSystemTools::ReplaceString(this->Id, "-", "");
if (this->Id.size() > 24) {
this->Id = this->Id.substr(0, 24);
}
this->Id = std::move(id);
this->TypeValue = type;
if (this->TypeValue == OBJECT) {