[Cmake] Determining host compiler/OS from CMake

Parag Chandra pchandra at mi-corporation.com
Thu Feb 28 14:37:27 EST 2002


Thanks, I forgot that, but I still get parse errors (different than ones
from before):

creating CMakeSystemConfig.cmake
CMake Error: Parse error in read function
In file:/cygdrive/c/development/Experimental/Mi-FormsReco/CMakeLists.txt
PROJECT (Recognition)

Here's a snippet from my CmakeLists.txt:

IF (CMAKE_CXX_COMPILER MATCHES "VC*60")
	ADD_DEFINITIONS (-D__FOO)
ELSE (CMAKE_CXX_COMPILER MATCHES "VC*60")
	ADD_DEFINITIONS (-D__BAR)
ENDIF (CMAKE_CXX_COMPILER MATCHES "VC*60")

PROJECT (Recognition)

Any ideas?

-----Original Message-----
From: Sebastien BARRE [mailto:sebastien.barre at kitware.com] 
Sent: Thursday, February 28, 2002 2:30 PM
To: Parag Chandra
Cc: 'Andy Cedilnik'; 'Bill Hoffman'; cmake at public.kitware.com
Subject: RE: [Cmake] Determining host compiler/OS from CMake

At 2/28/2002 02:20 PM, Parag Chandra wrote:
>Ok, well I searched in my CmakeCache file and I see that there is a
>CMAKE_CXX_COMPILER variable;

as well as CMAKE_GENERATOR

>  that might be good enough for my purposes.

Definitely.

>Now, how can I perform a test on that to see if it matches another
>string, i.e. something like:
>
>IF (CMAKE_CXX_COMPILER MATCHES "VC++60")
>         Do one command here
>ELSE (CMAKE_CXX_COMPILER MATCHES "VC++60")
>         Do another command otherwise
>ENDIF
>
>I tried both {$CMAKE_CXX_COMPILER} and the way listed above, and both
of
>them cause Cmake to complain with parse errors.

Unless you messed up with a copy/paste, the ENDIF should be:

ENDIF (CMAKE_CXX_COMPILER MATCHES "VC++60")


--
Sebastien Barre




More information about the CMake mailing list