[CMake] SET_CXX_COMPILER

Ian.Appru at ubs.com Ian.Appru at ubs.com
Fri Feb 17 03:42:22 EST 2006


Hi,

I found following commands worked ok with bash on linux and solaris

>set PATH=<path to compiler>:$PATH
>CXX=gcc && bootstrap

Regards
Ian

-----Original Message-----
From: cmake-bounces+ian.appru=ubs.com at cmake.org [mailto:cmake-bounces+ian.appru=ubs.com at cmake.org] On Behalf Of Sören Freudiger
Sent: 16 February 2006 17:48
To: cmake at cmake.org
Subject: AW: [CMake] SET_CXX_COMPILER

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

_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Visit our website at http://www.ubs.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.



More information about the CMake mailing list