[CMake] Changing compiler

David Doria daviddoria at gmail.com
Wed Apr 20 09:43:50 EDT 2011


On Wed, Apr 20, 2011 at 9:04 AM, David Cole <david.cole at kitware.com> wrote:
> If you are setting the CXX compiler, you should also probably be setting the
> C compiler.
>
> I always use environment variables to do this:
>
>   export CC=/home/doriad/src/gcc-4.5.2/bin/gcc/gcc
>   export CXX=/home/doriad/src/gcc-4.5.2/bin/gcc/g++
>   ccmake ../../src/ITK
>
> If that still doesn't work, then inspect the contents of the file
> CMakeFiles/CMakeError.log to see what the actual errors are, and post them
> here. (CMakeFiles/CMakeOutput.log may also have relevant results in it...)
>
>
> HTH,
> David C.

Hm, so there is no 'gcc' executable after I built gcc. Gcc's configure
says: "The following languages will be built:
c,c++,fortran,java,objc". So I'm assuming it should be there? I tried
setting the ITK C compiler to g++ as well, but no dice.

In CMakeFiles/CMakeError.log

of course it says:

CMakeCCompilerId.c:2:3: error: #error "A C++ compiler has been selected for C."

The executables that were built are:

[doriad at daviddesktop gcc]$ find . -executable -type f
./as
./cc1-dummy
./jcf-dump
./cc1
./jvgenmain
./gcj
./config.status
./lto-wrapper
./cc1plus-dummy
./cc1plus
./cc1obj-dummy
./gcov
./nm
./cpp
./f951
./xgcc
./cc1obj
./gfortran
./collect2
./collect-ld
./jc1
./g++
./gcov-dump

Any thoughts?

Thanks,

David


More information about the CMake mailing list