MantisBT - CMake
View Issue Details
0009125CMakeCMakepublic2009-06-09 20:552011-02-08 14:33
goatboy160 
David Cole 
normalfeaturealways
closedfixed 
CMake-2-6 
 
0009125: Add support to set GCC Version and Deployment Target for XCode projects
Xcode needs to support these options. I've added code to the GlobalXCodeGenerator to handle these two very important flags for XCode.

Here's a patch to the XCodeGlobalGenerator from 2.6.3

@@ -2481,6 +2487,10 @@
       this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT");
   const char* sysrootDefault =
     this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT_DEFAULT");
+ const char* gccVersion =
+ this->CurrentMakefile->GetDefinition("CMAKE_OSX_GCC_VERSION");
+ const char* deploymentTarget =
+ this->CurrentMakefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET");
   if(osxArch && sysroot)
     {
     bool flagsUsed = false;
@@ -2522,6 +2532,16 @@
                                   this->CreateString(sysroot));
       }
     }
+ if(gccVersion)
+ {
+ buildSettings->AddAttribute("GCC_VERSION",
+ this->CreateString(gccVersion));
+ }
+ if(deploymentTarget)
+ {
+ buildSettings->AddAttribute("MACOSX_DEPLOYMENT_TARGET",
+ this->CreateString(deploymentTarget));
+ }
   for( std::vector<cmXCodeObject*>::iterator i = configs.begin();
        i != configs.end(); ++i)
     {
No tags attached.
related to 0006195closed David Cole Add a "CMAKE_OSX_DEPLOYMENT_TARGET" to pass -mmin-macosx-version to gcc 
related to 0008915closed  Missing feature to set Xcode specific build settings 
related to 0008179closed David Cole Mac XCode generator: build type depend XCODE_ATTRIBUTE_* would be nice 
related to 0010722closed Brad King Add PlatformToolset support to Visual Studio 2010 generator 
related to 0009271closed Bill Hoffman Add ability to enable Objective-C Garbage Collection 
related to 0002582closed Kitware Robot Set XCode arguments from CMakeLists.txt 
related to 0008178closed Bill Hoffman Mac XCode generator: It is not possible to customize some important xcode settings 
Issue History
2009-06-09 20:55goatboy160New Issue
2009-10-07 01:07AngusNote Added: 0018003
2009-10-14 13:46Sean McBrideNote Added: 0018068
2010-02-12 14:11David ColeStatusnew => assigned
2010-02-12 14:11David ColeAssigned To => David Cole
2010-02-12 14:13David ColeNote Added: 0019521
2010-02-12 14:13David ColeStatusassigned => resolved
2010-02-12 14:13David ColeResolutionopen => fixed
2010-02-12 15:01David ColeStatusresolved => feedback
2010-02-12 15:01David ColeResolutionfixed => reopened
2010-02-12 15:02David ColeNote Added: 0019522
2010-02-12 15:02David ColeStatusfeedback => resolved
2010-02-12 15:02David ColeResolutionreopened => fixed
2010-02-12 16:21David ColeStatusresolved => feedback
2010-02-12 16:21David ColeResolutionfixed => reopened
2010-02-12 16:21David ColeRelationship addedrelated to 0006195
2010-02-12 16:21David ColeStatusfeedback => resolved
2010-02-12 16:21David ColeResolutionreopened => fixed
2010-03-30 11:08David ColeStatusresolved => feedback
2010-03-30 11:08David ColeResolutionfixed => reopened
2010-03-30 11:09David ColeNote Added: 0020033
2010-03-30 11:09David ColeStatusfeedback => resolved
2010-03-30 11:09David ColeResolutionreopened => fixed
2010-06-03 13:20Brad KingRelationship addedrelated to 0010722
2010-12-14 18:50David ColeNote Added: 0024111
2010-12-14 18:50David ColeStatusresolved => closed
2011-02-08 14:29David ColeRelationship addedrelated to 0008915
2011-02-08 14:33David ColeRelationship addedrelated to 0009271
2011-02-08 14:33David ColeRelationship addedrelated to 0008179
2011-02-08 14:34David ColeRelationship addedrelated to 0002582
2011-02-08 14:34David ColeRelationship addedrelated to 0008178

Notes
(0018003)
Angus   
2009-10-07 01:07   
CMAKE_OSX_GCC_VERSION is redundant: use CMAKE_C_VERSION and/or CMAKE_CXX_VERSION to set Xcode GCC_VERSION appropriately.
see http://www.itk.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F [^]
(0018068)
Sean McBride   
2009-10-14 13:46   
The 'deployment target' part of your request, if I understand you correctly, is covered by bug 0006195 (and fixed).
(0019521)
David Cole   
2010-02-12 14:13   
Fixed in CVS HEAD of CMake:

/cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.cxx,v <-- Source/cmGlobalXCodeGenerator.cxx
new revision: 1.242; previous revision: 1.241

To set the Xcode GCC_VERSION attribute, set a variable in the CMakeLists.txt file named CMAKE_XCODE_ATTRIBUTE_GCC_VERSION. By extension, set any variable named CMAKE_XCODE_ATTRIBUTE_XXXXX to set the correspondingly named XXXXX Xcode attribute.
(0019522)
David Cole   
2010-02-12 15:02   
And..... fix the style problem with the previous commit:

/cvsroot/CMake/CMake/Source/cmGlobalXCodeGenerator.cxx,v <-- Source/cmGlobalXCodeGenerator.cxx
new revision: 1.243; previous revision: 1.242
(0020033)
David Cole   
2010-03-30 11:09   
The fix for this issue was included in CMake 2.8.1 - rc3.
(0024111)
David Cole   
2010-12-14 18:50   
Closing bugs that have been resolved for more than 3 months without any further updates.