[CMake] cmake -DCMAKE_CXX_COMPILER=g++ does not work as expected

Alexander Neundorf a.neundorf-work at gmx.net
Tue Nov 13 15:44:01 EST 2007


On Tuesday 13 November 2007, Erik Johansson wrote:
> Hi,
>
> Running cmake with -DCMAKE_CXX_COMPILER=g++ gives the following output:
> -- Check for working CXX compiler: g++
> -- Check for working CXX compiler: g++ -- works
>
> But building fails since it tries to use g++ from the build dir. From
> CMakeCache.txt:
> CMAKE_CXX_COMPILER:FILEPATH=/home/erik/tmp/test/build/g++
>
> Running cmake with -DCMAKE_CXX_COMPILER:FILEPATH=g++ or even
> -DCMAKE_CXX_COMPILER:STRING=g++ gives the expected result. From
> CMakeCache.txt:
> CMAKE_CXX_COMPILER:FILEPATH=/usr/lib/ccache/g++
>
> Is this the expected behavior?

Hmm, yes, with cmake 2.4 if you don't specify the type it doesn't go into the 
cache.
Don't do that, but set the environment variable CXX instead.

It should work with cmake cvs.

Alex


More information about the CMake mailing list