[CMake] How to use non-default compiler in building a project

Brad King brad.king at kitware.com
Wed Sep 21 13:38:14 EDT 2005


Kris Thielemans wrote:
> I'm trying to install ITK on Linux but seem to have a cmake related problem.
> However, it might have something to the with how ITK uses cmake, so I
> apologise in advance if that's the case.
> 
> I do not want to use the default compiler that cmake finds (gcc,c++), but
> another version (gcc-3.3, g++-3.3).
[snip]
> Is there anything I can do to get this to work?

The compiler cannot be changed after the first configure because 
try-compile resluts may be inaccurate as a result.  You can set the 
compilers in the environment variables CC=gcc-3.3 and CXX=g++-3.3 before 
running CMake.

-Brad


More information about the CMake mailing list