[Cmake] Determining host compiler/OS from CMake

Andy Cedilnik Andy.Cedilnik at kitware.com
Thu Feb 28 12:14:30 EST 2002


At 11:53 AM 2/28/2002 -0500, Bill Hoffman wrote:
>Short answer: No, currently there is not.
>
>>Is there a predefined Cmake variable that I can use to determine the 
>>compiler and/or the operating system that Cmake is running under? I d 
>>like Cmake to be able to set some flags via the ADD_DEFINITIONS command 
>>using this information.

Not to want to start the flame fights, but it may be a good idea to add
some minimal support for getting compiler information in CMake.
I mean, you can always do things in your C files and determine
what compiler it is, but we could have something like:
CMAKE_CXX_COMPILER_TYPE, which would say something like
gcc,  hpux-aCC,  msvc, or bcc. This way developer could do some
tricks inside CMake versus inside source files.

There is a "hacky" way of determining certain things already. For
example you can say IF(BORLAND) for borland or IF(WIN32) IF(UNIX)
for cygwin and so on.

So, simple mechanism for describing compiler and platform:

COMPILER_TYPE=gcc
COMPILE_PLATFORM=win32
= cygwin

Comments?

                         Andy




More information about the CMake mailing list