[cmake-developers] [CMake 0012943]: Make code groups in xcode match visual studio

Mantis Bug Tracker mantis at public.kitware.com
Tue Feb 7 17:28:50 EST 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12943 
====================================================================== 
Reported By:                Michael Pechner
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12943
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-02-07 17:28 EST
Last Modified:              2012-02-07 17:28 EST
====================================================================== 
Summary:                    Make code groups in xcode match visual studio
Description: 
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.


Additional Information: 
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);

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-02-07 17:28 Michael PechnerNew Issue                                    
2012-02-07 17:28 Michael PechnerFile Added: cmGlobalXCodeGenerator_cxx.txt      
             
======================================================================




More information about the cmake-developers mailing list