CMake Support for different compilers

Allen Winter winter at kde.org
Tue Mar 21 16:56:01 CET 2006


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?

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


More information about the Kde-buildsystem mailing list