CMake Support for different compilers

Allen Winter winter at kde.org
Tue Mar 21 18:01:50 CET 2006


On Tuesday 21 March 2006 11:45, you wrote:
> At 10:56 AM 3/21/2006, Allen Winter wrote:
> >In FindKDE4Internal.cmake I'd like to at least setup the framework for
> >supporting different C/C++ compilers, including icecream, icc, etc.
> >
> >I assume we want to support the $CC and $CXX environment variables,
> >and also the CMAKE_C_COMPILER and CMAKE_CXX_COMPILER values.
> >
> >Does code like the following work?
> >if ($ENV{CC} MATCHES "[:print:]")
> >   set(CMAKE_C_COMPILER $ENV{CC})
> >endif ($ENV{CC} MATCHES "[:print:]")
> ># now set C compiler options based on which compiler being used
> >
> >But, if the user has $CC=gcc set but then runs "cmake -DCMAKE_C_COMPILER=icecream"
> >cmake will use gcc instead of icecream, and we probably agree that the command line
> >value (icecream) should override the environment variable.  So how do you tell cmake
> >to use the command line value in this case.
> >
> >Or am I totally off-track here?
> 
> The compiler should not be changed from within a cmakelist file.
> CMake already looks for CC and CXX environment variables for the compiler
> to try.
> 
OK.

So in FindKDE4Internal.cmake we don't check against the $CC or the $CXX environment variables.
All we need to do is look at ${CMAKE_C_COMPILER} and ${CMAKE_CXX_COMPILER} and
change  the flags, optimization and debug level options depending on those values??

-- 
Let's Keep the Political Talk Out of KDE PLEASE


More information about the Kde-buildsystem mailing list