[CMake] Changing compiler

David Cole david.cole at kitware.com
Wed Apr 20 09:04:02 EDT 2011


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.


On Wed, Apr 20, 2011 at 7:39 AM, David Doria <daviddoria at gmail.com> wrote:

> I am trying to build ITK with a non-system-standard compiler. I did so
> by running:
>
> ccmake ../../src/ITK/
> -DCMAKE_CXX_COMPILER=/home/doriad/src/gcc-4.5.2/bin/gcc/g++
>
> However, I get:
>
> ---------------
>  CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:45
>  (MESSAGE):
>   The C++ compiler "/home/doriad/src/gcc-4.5.2/bin/gcc/g++" is not able to
>   compile a simple test program.
>
>   It fails with the following output:
>
>    Change Dir: /home/doriad/bin/ITK/CMakeFiles/CMakeTmp
>
>
>
>   Run Build Command:/usr/bin/gmake "cmTryCompileExec/fast"
>
>   /usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make
>   CMakeFiles/cmTryCompileExec.dir/build
>
>   gmake[1]: Entering directory `/home/doriad/bin/ITK/CMakeFiles/CMakeTmp'
>
> ---------------
>
> This is indeed the correct path for the compiler:
>
> [doriad at daviddesktop ~]$ ~/src/gcc-4.5.2/bin/gcc/g++
> g++: no input files
>
> I tried creating a fresh build directory and nothing changed. Any
> suggestions of what else to do to use this compiler?
>
> Thanks,
>
> David
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110420/c03c8d60/attachment-0001.htm>


More information about the CMake mailing list