[CMake] Setting the compiler
Bill Hoffman
bill.hoffman at kitware.com
Fri Jul 27 15:35:36 EDT 2007
Juan Sanchez wrote:
> I'm evaluating CMAKE for use by our group and I am running into an issue
> with selecting the compiler.
>
> Is there any way to set the compiler and flags in the CMakeLists.txt
> file? This information appears to be ignored. The FAQ as well as the
> book suggest setting environment variables.
>
> We have a script which we can use to determine the platform we are on,
> but setting CMAKE_CXX_COMPILER in the if block of the CMakeLists.txt is
> ignored.
>
> An issue is that it would be hard to convince other developers to adopt
> CMAKE if this would require them to set environment variables every time
> they check out the source code and start building. Another issue is
> that they will be developing on both 32 and 64 bit machines, and would
> like to be able to use the same directory to do this. The compiler on
> each platform is in a different directory.
>
There really is not a way to do what you want. However, I don't see why
requiring an environment variable
is too much to ask? Most developers are going to have one compiler in
their PATH, and cmake should
pick it automatically. If they have more than one, it should not be
that much to ask that they setup the
environment so it is setup for the compiler they want to use. What are
they currently doing?
I suppose you could just create build scripts for each platform that
setup the environment and ran cmake for them.
-Bill
More information about the CMake
mailing list