[CMake] working around gcc version bug in xocde generator

David Cole david.cole at kitware.com
Tue Mar 30 09:59:07 EDT 2010


With CMake 2.8.1, you can, in your CMakeLists.txt file:
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "4.2")

Or, more precisely:
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.gcc.4_2")

This is part of the bug fix for
http://public.kitware.com/Bug/view.php?id=9125 which was included in the
2.8.1 release (rc3 and later...).

It is Xcode-generator specific, though, and has no effect on generated files
for other build systems.


HTH,
David


On Mon, Mar 29, 2010 at 4:12 PM, Simmons, Aaron
<asimmons at rosettastone.com>wrote:

> My project requires using gcc 4.0 when compiling on Mac OS X, as it has to
> support 10.4.  This works fine for the makefile generator, but it breaks
> with the XCode generator for Xcode 3.2 as the default gcc is v4.2.
>
> Other posts on this list indicates that it's a bug in the Xcode generator.
>  I would like to workaround this issue somehow until a new version of cmake
> is released.
>
> One poster suggested using gcc's -V option, which allows forcing the gcc
> version.  I've tried injecting this into the CMAKE_CXX_FLAGS like this:
>        if (${CMAKE_GENERATOR} MATCHES "Xcode")
>            set(CMAKE_CXX_FLAGS "-V 4.0 ${CMAKE_CXX_FLAGS}")
>        endif(${CMAKE_GENERATOR} MATCHES "Xcode")
>
> However, this creates a new error:
>        '-V' must come at the start of the command line
>
> It seems that the CMAKE_CXX_FLAGS are always appended to the constructed
> gcc command.  Is there some way that I can prepend flags (that is, put them
> at the very beginning of the command-line)?
>
>
> Thanks,
> aaron
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100330/d605c4d0/attachment.htm>


More information about the CMake mailing list