MantisBT - CMake
View Issue Details
0014133CMakeCMakepublic2013-05-09 06:302014-06-02 08:37
Stephan Tolksdorf 
Brad King 
normalminoralways
closedfixed 
MacOSX10.8.3
CMake 2.8.10.2 
CMake 3.0CMake 3.0 
0014133: CMake creates duplicate target subfolders in Xcode project files
When using the Xcode generator, the following cmake script creates two identically named subfolders "sub" below the folder "top", although it should only create one folder "sub" for both targets. I've tested this with CMake version 2.8.11 RC4 and Xcode 4.6.2

add_executable(test1 test1.cpp)
SET_PROPERTY(TARGET test1 PROPERTY FOLDER "top/sub")

add_executable(test2 test2.cpp)
SET_PROPERTY(TARGET test2 PROPERTY FOLDER "top/sub")
Generate an Xcode project file for the attached test project.
No tags attached.
related to 0010039closed Brad King Xcode gen only creates one level of group nesting 
zip FolderTest.zip (1,026) 2013-05-09 06:30
https://public.kitware.com/Bug/file/4758/FolderTest.zip
patch xcode-folder.patch (1,219) 2013-11-28 08:58
https://public.kitware.com/Bug/file/4984/xcode-folder.patch
Issue History
2013-05-09 06:30Stephan TolksdorfNew Issue
2013-05-09 06:30Stephan TolksdorfFile Added: FolderTest.zip
2013-05-10 10:53Brad KingNote Added: 0033026
2013-05-10 10:53Brad KingStatusnew => backlog
2013-05-10 10:55Brad KingRelationship addedrelated to 0010039
2013-11-28 08:58Stephan TolksdorfFile Added: xcode-folder.patch
2013-11-28 09:02Stephan TolksdorfNote Added: 0034611
2013-12-02 09:58Brad KingNote Added: 0034668
2013-12-02 09:58Brad KingAssigned To => Brad King
2013-12-02 09:58Brad KingStatusbacklog => resolved
2013-12-02 09:58Brad KingResolutionopen => fixed
2013-12-02 09:58Brad KingFixed in Version => CMake 3.0
2013-12-02 09:58Brad KingTarget Version => CMake 3.0
2014-06-02 08:37Robert MaynardNote Added: 0036045
2014-06-02 08:37Robert MaynardStatusresolved => closed

Notes
(0033026)
Brad King   
2013-05-10 10:53   
This is likely a problem with the logic in cmGlobalXCodeGenerator::CreateOrGetPBXGroup:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmGlobalXCodeGenerator.cxx;hb=v2.8.10.2#l2811 [^]

This was likely introduced when the feature was first implemented for the Xcode generator:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eeeeca10 [^]
(0034611)
Stephan Tolksdorf   
2013-11-28 09:02   
I've attached a patch that fixes the issue. The problem was that no slash was appended to the curr_tgt_folder string on the it != this->TargetGroup.end() path.
(0034668)
Brad King   
2013-12-02 09:58   
Applied, thanks:

Xcode: Fix duplicate target subfolders
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2dcb1dc9 [^]
(0036045)
Robert Maynard   
2014-06-02 08:37   
Closing resolved issues that have not been updated in more than 4 months.