MantisBT - CMake
View Issue Details
0011690CMakeCMakepublic2011-01-12 14:562012-01-02 15:56
jdale 
David Cole 
highminoralways
closedfixed 
Apple MacOS X10.4.10
CMake 2.8.3 
CMake 2.8.6CMake 2.8.6 
0011690: Xcode project generator always overwrites user settings
When generating an Xcode project using CMake, it will completely remove "<project name>.xcodeproj" before generating a new one. The problem with this is that "<project name>.xcodeproj" is actually a folder, not a file.

Contained within this folder you will find the following:
project.pbxproj <-- The actual Xcode project information
<username>.pbxuser <-- Your user data for this project
<username>.mode1v3 (or something similar) <-- Your layout data for this project

When generating an Xcode project, it should *only* generate a new "<project name>.xcodeproj" *if* one doesn't already exist. If one does already exist, it *only* needs to change the pbxproj file inside to update the Xcode project. This will allow CMake to be run without constantly losing your user settings which is *very* annoying when you're working on a project with multiple executables as it keeps forgetting which one you had selected!
Create an Xcode project using CMake
Change some user settings (such as the build target)
Regenerate the Xcode project and reload it in Xcode
Your changes will be lost
No tags attached.
patch 0001-Xcode-Remember-generated-ObjectIDs-in-the-cache-to-a.patch (4,611) 2011-01-30 16:47
https://public.kitware.com/Bug/file/3668/0001-Xcode-Remember-generated-ObjectIDs-in-the-cache-to-a.patch
patch 0001-xcode-Remember-generated-objectIDs-in-the-CMakeCache.patch (4,708) 2011-01-31 14:34
https://public.kitware.com/Bug/file/3669/0001-xcode-Remember-generated-objectIDs-in-the-CMakeCache.patch
patch 0002-XCode-Reuse-ObjectIDs.-This-version-uses-CoreFoundat.patch (8,173) 2011-02-15 09:35
https://public.kitware.com/Bug/file/3699/0002-XCode-Reuse-ObjectIDs.-This-version-uses-CoreFoundat.patch
patch 0001-Save-objectIDS.patch (8,015) 2011-02-15 14:23
https://public.kitware.com/Bug/file/3704/0001-Save-objectIDS.patch
Issue History
2011-01-12 14:56jdaleNew Issue
2011-01-12 14:58jdaleNote Added: 0024632
2011-01-12 16:33Johan BjörkNote Added: 0024633
2011-01-17 15:04David ColeAssigned To => David Cole
2011-01-17 15:04David ColeStatusnew => assigned
2011-01-17 15:04David ColeNote Added: 0024799
2011-01-30 16:47Johan BjörkFile Added: 0001-Xcode-Remember-generated-ObjectIDs-in-the-cache-to-a.patch
2011-01-30 16:52Johan BjörkNote Added: 0025169
2011-01-30 20:34David ColeNote Added: 0025172
2011-01-31 03:00Johan BjörkNote Added: 0025174
2011-01-31 14:34Johan BjörkFile Added: 0001-xcode-Remember-generated-objectIDs-in-the-CMakeCache.patch
2011-01-31 14:35Johan BjörkNote Added: 0025181
2011-01-31 14:36Johan BjörkNote Edited: 0025181bug_revision_view_page.php?bugnote_id=25181#r180
2011-02-08 05:14Johan BjörkNote Added: 0025321
2011-02-15 09:35Johan BjörkFile Added: 0002-XCode-Reuse-ObjectIDs.-This-version-uses-CoreFoundat.patch
2011-02-15 09:35Johan BjörkNote Added: 0025436
2011-02-15 14:23Johan BjörkFile Added: 0001-Save-objectIDS.patch
2011-02-15 14:24Johan BjörkNote Edited: 0025436bug_revision_view_page.php?bugnote_id=25436#r203
2011-04-14 14:35David ColeTarget Version => CMake 2.8.5
2011-06-21 13:06David ColeNote Added: 0026941
2011-06-21 13:06David ColeTarget VersionCMake 2.8.5 =>
2011-08-02 10:56Sean McBrideNote Added: 0027150
2011-08-03 12:10David ColeTarget Version => CMake 2.8.6
2011-08-24 18:49David ColeNote Added: 0027268
2011-08-24 18:49David ColeStatusassigned => resolved
2011-08-24 18:49David ColeFixed in Version => CMake 2.8.6
2011-08-24 18:49David ColeResolutionopen => fixed
2012-01-02 15:56David ColeNote Added: 0028134
2012-01-02 15:56David ColeStatusresolved => closed

Notes
(0024632)
jdale   
2011-01-12 14:58   
Oops, I'm actually using OS X 10.6.5, not what it says on the bug. I'm also using Xcode 3.2.5, just in case it matters.
(0024633)
Johan Björk   
2011-01-12 16:33   
It actually correctly keeps the folder and such, the issue is that it randomizes the GUIDs. See comments here: http://www.cmake.org/pipermail/cmake/2010-December/041555.html [^] and http://public.kitware.com/pipermail/cmake-developers/2010-December/000959.html. [^]

I'm working on a patch that follows bills advice.
(0024799)
David Cole   
2011-01-17 15:04   
Let me know when you get your patch working...

Thanks.
(0025169)
Johan Björk   
2011-01-30 16:52   
Attached a patch. I tried to keep the patch to a minimum, since I know other people are doing larger works against the xcode generator. It seems when doing modifications to the cache in the xcode generator, it wasn't automatically written out, so I added a saveCache() call. I'm not sure if this is the correct way of doing things.

There is also the cmGlobalGenerator::createGUID + getGUID() calls. I could not figure out how to properly use these, or their relation to the xcode object files, so I did not use it.
(0025172)
David Cole   
2011-01-30 20:34   
Thanks for the patch. I'll take a look at it sometime in the next week or so and let you know what I think.
(0025174)
Johan Björk   
2011-01-31 03:00   
ignore the patch for now, seems I broke quite a few of the tests.
(0025181)
Johan Björk   
2011-01-31 14:35   
(edited on: 2011-01-31 14:36)
0001-xcode-Remember-generated-objectIDs-in-the-CMakeCache.patch is the fixed patch. I had a misstake where objectIDs would be duplicated if the PROJECT name was the same as one of the targets. It now passes all cmake tests on my machine.

(0025321)
Johan Björk   
2011-02-08 05:14   
and after using it for a bit, this is still broken. The chances of collisions are quite high because it generates IDs based of the heap-location of the objects. Will fix and post updated patch asap.
(0025436)
Johan Björk   
2011-02-15 09:35   
(edited on: 2011-02-15 14:24)
New version that asserts for duplicate object IDs and uses CoreFoundation to generate real UUID's instead of using the address of the created object.

(0026941)
David Cole   
2011-06-21 13:06   
Fix not ready and stable on time for release in 2.8.5, unsetting target version field...
(0027150)
Sean McBride   
2011-08-02 10:56   
I haven't tried the patch, but very much agree this would be nice to fix. The described bug is very annoying.

Another specific problem is if one use svn, then there's also a .svn folder in the .xcodeproj folder, and it's presumably blown away too, which confuses svn to no end (happily svn 1.7 will have only one .svn folder at the root).
(0027268)
David Cole   
2011-08-24 18:49   
(slightly modified) patch applied and merged to 'next':

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1834f232a7f782eadd238a78481e3f9086095e97 [^]
(0028134)
David Cole   
2012-01-02 15:56   
Closing resolved issues that have not been updated in more than 4 months.