[CMake] Trouble changing C/C++ compiler, CMake reverts my choice
Bill Hoffman
bill.hoffman at kitware.com
Fri Sep 7 16:12:25 EDT 2007
Sean McBride wrote:
> Hi all,
>
> CMake 2.4.7 finds gcc on my machine and everything works fine. However,
> I also have installed a different version of gcc but when I point CMake
> to it (by changing CMAKE_C_COMPILER and CMAKE_CXX_COMPILER) the change
> is reverted after I do 'configure'. I'm sure the path is correct. No
> error message is given. Both versions of gcc work fine outside of CMake.
>
> What is going on?
>
You can not change the compiler after cmake has run. I need to remove
those variables from
the edit part of the cache. You have to set CC, CXX environment before
you run cmake or
specify those values with -D on the command line of cmake.
setenv CC gcc-XXX
setenv CXX c++-XXX
cmake ...
or
cmake -DCMAKE_C_COMPILER=gcc-XXX -DCMAKE_CXX_COMPILER=c++-XXX
-Bill
More information about the CMake
mailing list