MantisBT - CMake
View Issue Details
0012943CMakeCMakepublic2012-02-07 17:282013-07-01 09:37
Michael Pechner 
 
normalminoralways
closedfixed 
appleosx10.6
CMake 2.8.4 
CMake 2.8.11CMake 2.8.11 
0012943: Make code groups in xcode match visual studio
We have a product where 2 of the platforms are windown and osx. The groupings of files in xcode should match visual studio.

I am submitting this in behalf of another engineer that left the company. I am submitting this myself because it is the only way to contribute changes back. OY!

Here is his explanation:


So the source group change fixed a problem specific to Xcode. It's possible to specify a "\\" delimited directory structure as a group name. So you can do the following:

source_group( foo foo.c)
source_group( foo\\bar bar.c)

In the VS generator that makes a group foo that contains a group bar and the file foo.c. The group bar contains the file bar.c This behavior is documented.

Those same lines in the the xcode generator create two groups. One is called foo and contains foo.c. The other is called "foo/bar" and contains bar.c. This behavior is not documented

The change corrects the xcode generator behavior to match that of the visual studio generator/documentation.

If memory serves... The code that was added iterates over the platform-independent source_group data structure the right way (which preserves nesting in a recursive fashion) rather than just enumerating every possible group and adding them without nesting. The diff should be helpful here, because I believe I checked the whole thing in as a single change.
I'll include a diff of when we did for both cmGlobalXCodeGenerator.cxx and cmGlobalXCodeGenerator.h
The diff is between 2.8.4 and 2.8.7.

Here is the .h file diff:

89,91d88
< cmXCodeObject* CreateSourceGroup(cmSourceGroup& sg,
< cmTarget& cmtarget,
< bool child_group);
93,94c90,92
< cmSourceGroup* sg,
< bool target_child);
---
> cmSourceGroup* sg);
> cmXCodeObject* CreatePBXGroup(cmXCodeObject *parent,
> cmStdString name);
127a126,127
> std::string GetOrCreateId(const char* name, const char* id);
>
197,198c197,198
< virtual const char* GetInstallTargetName() { return "install"; }
< virtual const char* GetPackageTargetName() { return "package"; }
---
> virtual const char* GetInstallTargetName() const { return "install"; }
> virtual const char* GetPackageTargetName() const { return "package"; }
201a202
> std::set<cmStdString> XCodeObjectIDs;
204a206,208
> void addObject(cmXCodeObject *obj);
> std::string PostBuildMakeTarget(std::string const& tName,
> std::string const& configName);
No tags attached.
txt cmGlobalXCodeGenerator_cxx.txt (23,950) 2012-02-07 17:28
https://public.kitware.com/Bug/file/4207/cmGlobalXCodeGenerator_cxx.txt
patch 0001-Fixed-nested-source-group-handling-in-Xcode-generato.patch (907) 2012-09-28 16:06
https://public.kitware.com/Bug/file/4503/0001-Fixed-nested-source-group-handling-in-Xcode-generato.patch
Issue History
2012-02-07 17:28Michael PechnerNew Issue
2012-02-07 17:28Michael PechnerFile Added: cmGlobalXCodeGenerator_cxx.txt
2012-08-11 21:09David ColeStatusnew => backlog
2012-08-11 21:09David ColeNote Added: 0030359
2012-09-28 16:06Mad FishFile Added: 0001-Fixed-nested-source-group-handling-in-Xcode-generato.patch
2012-09-28 16:07Mad FishNote Added: 0031110
2013-02-18 11:12Brad KingNote Added: 0032332
2013-02-18 11:13Brad KingNote Added: 0032333
2013-02-18 11:13Brad KingStatusbacklog => resolved
2013-02-18 11:13Brad KingResolutionopen => fixed
2013-02-18 11:13Brad KingFixed in Version => CMake 2.8.11
2013-02-18 11:13Brad KingTarget Version => CMake 2.8.11
2013-07-01 09:37Robert MaynardNote Added: 0033428
2013-07-01 09:37Robert MaynardStatusresolved => closed

Notes
(0030359)
David Cole   
2012-08-11 21:09   
Sending old, never assigned issues to the backlog.

(The age of the bug, plus the fact that it's never been assigned to anyone means that nobody is actively working on it...)

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it: http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer who has the bandwidth to take it on, and ferry a fix through to our 'next' branch for dashboard testing.
(0031110)
Mad Fish   
2012-09-28 16:07   
Attached a trivial patch that solves the problem.
(0032332)
Brad King   
2013-02-18 11:12   
Patch 0001-Fixed-nested-source-group-handling-in-Xcode-generato.patch applied here:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0816caec [^]
(0032333)
Brad King   
2013-02-18 11:13   
Resolving as fixed. Please re-open if there are additional differences this does not address.
(0033428)
Robert Maynard   
2013-07-01 09:37   
Closing resolved issues that have not been updated in more than 4 months.