MantisBT - CMake
View Issue Details
0007932CMakeCMakepublic2008-11-03 17:092012-01-02 15:56
goatboy160 
Bill Hoffman 
normalmajoralways
closedfixed 
CMake-2-6 
CMake 2.8.5CMake 2.8.5 
0007932: XCode Source Grouping doesn't allow for multiple levels of source groups
In my CMakeLists files I have something like this

set( SOURCES misc/foo.c misc/junk.c misc/stuff.c )
source_group( "source\\misc" FILES ${SOURCES} )
set( MAC_SOURCES misc/mac/fancy.c misc/mac/jobs.c )
source_group( "source\\misc\\mac" FILES ${MAC_SOURCES} )


These cmake files are shared between Windows and Mac, and the VS project is created properly with multiple directories reflecting the file system. However the XCode project creates two source groups "misc" and "mac" and the same level, and the mac directory should below the misc folder.
No tags attached.
related to 0011244closed Brad King Using Xcode built-in variables as CMAKE_OSX_ARCHITECTURES 
has duplicate 0008535closed David Cole Nested source groups not supported for XCode 
diff group_source.diff (3,450) 2008-11-06 13:45
https://public.kitware.com/Bug/file/1834/group_source.diff
diff group_source2.diff (5,006) 2010-09-25 08:25
https://public.kitware.com/Bug/file/3411/group_source2.diff
diff group_source3.diff (5,864) 2010-10-09 07:12
https://public.kitware.com/Bug/file/3442/group_source3.diff
Issue History
2008-11-03 17:09goatboy160New Issue
2008-11-06 13:45goatboy160Note Added: 0014052
2008-11-06 13:45goatboy160File Added: group_source.diff
2009-09-21 13:22Bill HoffmanStatusnew => assigned
2009-09-21 13:22Bill HoffmanAssigned To => Bill Hoffman
2009-10-04 00:06Claus HöfeleNote Added: 0017937
2010-09-21 06:25Claus HöfeleNote Added: 0022288
2010-09-21 14:20Bill HoffmanNote Added: 0022301
2010-09-22 00:58Claus HöfeleNote Added: 0022315
2010-09-22 10:40Bill HoffmanNote Added: 0022317
2010-09-22 17:32Claus HöfeleNote Added: 0022323
2010-09-23 12:00Bill HoffmanRelationship addedrelated to 0011244
2010-09-23 12:01Bill HoffmanNote Added: 0022337
2010-09-25 08:25Claus HöfeleFile Added: group_source2.diff
2010-09-25 08:26Claus HöfeleNote Added: 0022345
2010-09-28 14:40Bill HoffmanNote Added: 0022378
2010-09-28 18:16Bill HoffmanNote Added: 0022379
2010-09-29 08:58Bill HoffmanNote Added: 0022381
2010-09-29 19:50Claus HöfeleNote Added: 0022387
2010-10-09 07:12Claus HöfeleFile Added: group_source3.diff
2010-10-09 07:20Claus HöfeleNote Added: 0022460
2010-10-09 07:21Claus HöfeleNote Edited: 0022460
2011-04-01 16:00Joé DupuisNote Added: 0026026
2011-08-18 11:45Johan BjörkNote Added: 0027235
2011-08-18 11:52David ColeNote Added: 0027237
2011-08-18 11:52David ColeStatusassigned => resolved
2011-08-18 11:52David ColeFixed in Version => CMake 2.8.5
2011-08-18 11:52David ColeResolutionopen => fixed
2011-08-18 12:01David ColeTarget Version => CMake 2.8.5
2011-08-18 12:05David ColeRelationship addedhas duplicate 0008535
2012-01-02 15:56David ColeNote Added: 0028129
2012-01-02 15:56David ColeStatusresolved => closed

Notes
(0014052)
goatboy160   
2008-11-06 13:45   
Attaching a diff of the changes I made to my local copy of the XCodeGenerator to properly nest source groups.
(0017937)
Claus Höfele   
2009-10-04 00:06   
Looks like the same issue as 0008535. Would be great if this issue could be fixed.
(0022288)
Claus Höfele   
2010-09-21 06:25   
Nearly two years since this bug has been reported and still broken in 2.8.0.
(0022301)
Bill Hoffman   
2010-09-21 14:20   
This patch no longer cleanly goes into git master. If someone could update the patch I will push it into next.
(0022315)
Claus Höfele   
2010-09-22 00:58   
I can try to fix this issue if goatboy160 isn't interested in this problem any more.

However, the Xcode generator seems broken in 2.8.1 and 2.8.2. When I generate a project file with these cmake versions, Xcode 3.2 shows the error "Unable to open project file." (That's why I'm still using 2.8.0.)

Bill: are you aware of this issue? Does the latest code in git fix this problem?

Until the project generation issue is fixed, I can't test the source code grouping.
(0022317)
Bill Hoffman   
2010-09-22 10:40   
What????

We have several dashboards and as far as I know CMake never had a problem 2.8.1 2.8.2 with Xcode!!!


Do you have a sample test that fails?
(0022323)
Claus Höfele   
2010-09-22 17:32   
Bill: Can you please send your email address to claus at claushoefele dot com. I can send you a project that reproduces the problem, but I don't want to put the souce code in a public forum. (It's part of a larger project; I'll try to create a simple test case.)
(0022337)
Bill Hoffman   
2010-09-23 12:01   
OK, I reproduced your issue. And just as I went to fix it.... I found that it had been fixed on Monday! See the related bug that I added to this issue. That said, I still need the updated patch for the source group issue.
(0022345)
Claus Höfele   
2010-09-25 08:26   
I updated the patch, see group_source2.diff.
(0022378)
Bill Hoffman   
2010-09-28 14:40   
OK, I just pushed the fix for this into next for CMake git, thanks!
(0022379)
Bill Hoffman   
2010-09-28 18:16   
OK, I may have to pull this patch, it causes Xcode to crash when loading files.

There is a test in CMake/Tests/SourceGroups:
# this is not really a test which can fail
# it is more an example with several source_group()
# commands.
# The created projects have to be loaded manually
# in Visual Studio/XCode/Eclipse/...
# to see whether the correct groups have been created.

However, the comment is not really right! It does fail with this patch.

It fails when you try to build with xcodebuild:

kitware@dashmacmini2 $ xcodebuild . ~/hoffman/My Tests/CMake-xcode/Tests/SourceGroups
zsh: 5703 segmentation fault xcodebuild .
kitware@dashmacmini2 $ ~/hoffman/My Tests/CMake-xcode/Tests/SourceGroups
(0022381)
Bill Hoffman   
2010-09-29 08:58   
The patch has been reverted. I am not going to put it back until someone can make the test pass with the patch. To run the tests do this:

mkdir build
cmake -GXcode ../path/to/cmake
cmake --build .
ctest


To run just that test do this:

ctest -R SourceGroups
(0022387)
Claus Höfele   
2010-09-29 19:50   
I can reproduce the problem with the SourceGroups test. I'll look into it, but won't have time until mid October.
(0022460)
Claus Höfele   
2010-10-09 07:20   
(edited on: 2010-10-09 07:21)
I attached an updated version that fixes the problem (group_source3.diff). Patch is against cmake sources from today.

The problem was related to a sub group with the same name as another group. I changed the indexing of the group names so that the full path to the group is now used as the key instead of the last part only.

I also now exclude the ALL_BUILD target in the source file view, which makes the project more readable. ALL_BUILD is still listed in the Target section.

Let me know if there's any problem.

(0026026)
Joé Dupuis   
2011-04-01 16:00   
The CTest passed with success on the third patch ( group_source3.diff). Is there anything more to do before it can be pulled in the repo ?
(0027235)
Johan Björk   
2011-08-18 11:45   
This is already fixed in 2.8.5
(0027237)
David Cole   
2011-08-18 11:52   
Thanks, Johan, for pointing out that this one is already fixed...
(0028129)
David Cole   
2012-01-02 15:56   
Closing resolved issues that have not been updated in more than 4 months.