summaryrefslogtreecommitdiffstats
path: root/Source/cmXCodeObject.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmXCodeObject.cxx')
-rw-r--r--Source/cmXCodeObject.cxx40
1 files changed, 21 insertions, 19 deletions
diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx
index 30e5076..30ade96 100644
--- a/Source/cmXCodeObject.cxx
+++ b/Source/cmXCodeObject.cxx
@@ -12,6 +12,8 @@
#include "cmXCodeObject.h"
#include "cmSystemTools.h"
+#include <CoreFoundation/CoreFoundation.h> // CFUUIDCreate
+
//----------------------------------------------------------------------------
const char* cmXCodeObject::PBXTypeNames[] = {
"PBXGroup", "PBXBuildStyle", "PBXProject", "PBXHeadersBuildPhase",
@@ -39,35 +41,35 @@ cmXCodeObject::cmXCodeObject(PBXType ptype, Type type)
this->PBXTargetDependencyValue = 0;
this->Target = 0;
this->Object =0;
-
+
this->IsA = ptype;
+
if(type == OBJECT)
{
- cmOStringStream str;
- str << (void*)this;
- str << (void*)this;
- str << (void*)this;
- this->Id = str.str();
+ // 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 refered to in xcode file";
- }
- cmSystemTools::ReplaceString(this->Id, "0x", "");
- this->Id = cmSystemTools::UpperCase(this->Id);
- if(this->Id.size() < 24)
- {
- int diff = 24 - this->Id.size();
- for(int i =0; i < diff; ++i)
- {
- this->Id += "0";
- }
+ 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 = this->Id.substr(0, 24);
}
+
this->TypeValue = type;
if(this->TypeValue == OBJECT)
{