[cmake-developers] Xcode generator does not recognize -Ofast

Brad King brad.king at kitware.com
Mon Jul 6 14:22:05 EDT 2015


On 07/03/2015 10:48 PM, umireon at gmail.com wrote:
> However, the Xcode Generator does not handle the -Ofast flag properly,  
> and then it is necessary to the set Optimization Level manually  
> when -Ofast flag is utilized in the project.  
> 
> This is because the Xcode Generator uses just one letter right after the `-O`  
> to determine what the project setting should be.  
> When `-O3` is given, `3` is used for Optimization Level and everything is fine,  
> but when `-Ofast` is given, `f` is used for it, which is an invalid value.  
> 
> It is not tested but it can be resolved by accepting all letter after `-O` flags.  
> 
> Here is the relevant code handling Optimization Level:  
> https://github.com/Kitware/CMake/blob/3ae8e84ef5c94e5fa250b4e2466aa6632a233bb2/Source/cmGlobalXCodeGenerator.cxx#L2218  

This is basically the same problem discussed here:

 Feature Request: Modify CXX_STANDARD behavior for Xcode Generator: Starting Tips
 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/13557/focus=13572

The Xcode generator needs more complete flag->attribute mapping.

Since we already have special handling for optimization flags one could
extend it to cover the -Ofast case explicitly without introducing the
full solution.

-Brad



More information about the cmake-developers mailing list