[CMake] recommended way to test for msvc/cl ?

Filipe Sousa filipe at ipb.pt
Sun Jan 29 12:41:04 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexander Neundorf wrote:
> Hi, 
>  
> what's the recommended way to test in a CMakeLists.txt, whether the 
> current compiler is msvc/cl ? 
>  
> I found: 
> UNIX 
> APPLE 
> WIN32 
> CYGWIN 
> MINGW 
> BORLAND 
>  
> I can't test, but I guess e.g. WIN32 is true for CYGWIN, MINGW, BORLAND 
> and msvc/cl. 
>  
> There is a variable CMAKE_COMPILER_IS_GNUCC, which is set for gcc. AFAIK 
> there is no CMAKE_COMPILER_IS_MSVC.  
> There are CMAKE_C_COMPILER and CMAKE_GENERATOR_CC, which are probably set 
> to "cl" both for MSVC and nmake Makefiles ? 
>  
> So which test is recommended ? 
>  
> Or how about adding a "MSVC" to the list above ? 

In my projects I always use IF(WIN32) but I only support MSVC. Having
MSVC var would help. Maybe this var should be defined in Windows-cl.cmake.

> Bye 
> Alex 
>  
> 


- --
Filipe Sousa
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFD3P4wbQdNYqwwwCwRAoG3AKCU81QM7KhVyWlCrKKJody5BLI7AACguO7s
vI6GxuRSVhMDV1sf7L/s6g4=
=fNVF
-----END PGP SIGNATURE-----


More information about the CMake mailing list