[CMake] Setting the cmake compiler...

Brad King brad.king at kitware.com
Fri Oct 20 08:48:21 EDT 2006


Peter Soetens wrote:
> The following happened to me (cmake version 2.4-patch 2) :
> 
> $ mkdir build
> $ cd build
> $ cmake .. -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CC_COMPILER=gcc
> -- Check for working C compiler: gcc
> -- Check for working C compiler: gcc -- works
> -- Check size of void*
> -- Check size of void* - done
> -- Check for working CXX compiler: g++
> -- Check for working CXX compiler: g++ -- works
> 
> [ ... a bit later ... ]
> 
> -- Looking for C++ include ftd2xx.h
> CMake Error: your CXX compiler: "/home/sspr/src/orocos-components/build/g++" 
> was not found.   Please set CMAKE_CXX_COMPILER to a valid compiler path or 
> name.
> CMake Error: Internal CMake error, TryCompile configure of cmake failed
> 
> First it works, then suddenly it doesn't [1]. Now I see cmake wants an 
> absolute path, so I do the following:
> 
> $ cmake .. -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_CC_COMPILER=/usr/bin/gcc
> CMake Error: your CXX compiler: "/home/sspr/src/orocos-components/build2/g++" 
> was not found.   Please set CMAKE_CXX_COMPILER to a valid compiler path or 
> name.

Any time you change the compiler you have to wipe out the build tree and
start from scratch.  Try running CMake like this instead:

$ rm -rf build; mkdir build; cd build
$ CC=gcc CXX=g++ cmake ..

-Brad


More information about the CMake mailing list