[CMake] XCode compiler selection

David Cole david.cole at kitware.com
Fri Jan 28 09:09:34 EST 2011


On Fri, Jan 28, 2011 at 8:39 AM, Andrew Corrigan
<acorriga at lcp.nrl.navy.mil> wrote:
> I use the latest released version of CMake  When I set the compiler with CMake for the XCode generator my choice of compiler is completely ignored, and I have to manually select the compiler within XCode.  In particular, I want to be able to select the Intel compilers, as opposed to Gcc-4.2.  There is a discussion on this list [1] from last June which discusses the same problem, without any resolution . without any resolution. It seems to me that this is a bug.    Are there any workarounds to this issue which are better than having to set the compiler manually every time I regenerate my XCode project?
>
> Thanks,
> Andrew Corrigan
>
> [1] http://www.cmake.org/pipermail/cmake/2010-June/037353.html
> _______________________________________________
> 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
>

The short answer is "no" -- there are no better workarounds at the
moment. Unless you can set it via Xcode attributes somehow. (See
http://public.kitware.com/Bug/view.php?id=9125 -- although because of
the following long answer, this solution falls short and is
incomplete.)


The long answer is: it's complicated. Xcode and Visual Studio both
support easy built-in ways to switch compilers within the same project
file. But CMake generated projects need to use a single compiler for
all try_compile operations, results of which may not be valid relative
to some other compiler.

There's this long-standing historical assumption that there's a single
compiler per IDE, and that when you build with a given IDE you're
intending to use the default compiler available in that IDE. (Hence
the need, for example, for separate Visual Studio generators for
"regular" and "Win64" solution and project files.)

To make what you want feasible in the long term is going to take some
re-design, some thought and some effort. If you have any great ideas
about how we can support this, but still keep try_compile results
valid, let us know.


Thanks, (hope this is helpful...)
David


More information about the CMake mailing list