AW: [CMake] SET_CXX_COMPILER
Sören Freudiger
muffmolch at gmx.de
Thu Feb 16 12:48:10 EST 2006
hmm, sorry about to say that, but:
this doesn't seems to work.
bash:
export CXX="gcc"
or
export CXX="mpicxx"
CMakeLists.txt
MESSAGE(${CMAKE_CXX_COMPILER})
results in "ccmake ."
c++
and is CMAKE_CXX_COMPILER set to: /usr/bin/c++
what can I do?
I tested the last stable cmake version 2.2 patch 3 and 2.2 develop from CVS
Kind regards,
CMakeAnn
-----Ursprüngliche Nachricht-----
Von: William A. Hoffman [mailto:billlist at nycap.rr.com]
Gesendet: Donnerstag, 16. Februar 2006 14:03
An: Sören Freudiger; cmake at cmake.org
Betreff: Re: [CMake] SET_CXX_COMPILER
At 03:12 AM 2/16/2006, Sören Freudiger wrote:
>Hi folks
>
>two questions:
>
>1. my macro:
> MACRO(SET_CXX_COMPILER compiler)
> SET(CMAKE_CXX_COMPILER ${compiler} CACHE STRING "C++ compiler"
>FORCE)
> ENDMACRO(SET_CXX_COMPILER)
>
>and my implementation:
> SET_CXX_COMPILER("distcc mpicxx")
>
>results in a build.cmake file with
>
> distcc\ mpicxx ...
>
>the problem is the backslash "\" before the blank. How can the be avoided?
>Like this I cannot execute make.
>
>2. why does the compiler not change at the build.cmake file by changing
>the
>C++ compiler within the advanced options in ccmake? I can set the
>C++ compiler
>within ccmake e.g. to gcc, but I always get the "c++"-compiler at the
>build file?
>(of course only if I am not using my SET_CXX_COMPILER macro...).
>
>Hoping for answers,
>QuestAnn
Because of the way the compiler is tested and used for setting things up, it
is not a good idea to change it after the language has been enabled.
The way to do what you want is this:
export CXX = "distcc mpicxx"
cmake ../project
You can tell cmake what compiler to use before running cmake with the
environment variables CC and CXX. However, I seem to remember a bug with
this, and you may have to use CVS cmake for this to work correctly.
-Bill
More information about the CMake
mailing list