summaryrefslogtreecommitdiffstats
path: root/Source/cmXCodeObject.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2011-08-23 22:22:33 (GMT)
committerDavid Cole <david.cole@kitware.com>2011-08-24 22:11:32 (GMT)
commit1834f232a7f782eadd238a78481e3f9086095e97 (patch)
tree88f10cdfeb70c609a68749636488200dcf184d08 /Source/cmXCodeObject.cxx
parentfe46e7e4866bd1a7678e1381da02df8c9f533aa0 (diff)
downloadCMake-1834f232a7f782eadd238a78481e3f9086095e97.zip
CMake-1834f232a7f782eadd238a78481e3f9086095e97.tar.gz
CMake-1834f232a7f782eadd238a78481e3f9086095e97.tar.bz2
Xcode: Save object id values in CMakeCache.txt (#11690)
For project and target objects, save their ids in CMakeCache.txt. Hopefully, that will be enough to allow user settings to be saved across multiple CMake generate operations. Other object types may also need their ids saved: if so, more code than this commit will be necessary...
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)
{