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

Alexander Neundorf a.neundorf-work at gmx.net
Mon Jan 30 13:38:37 EST 2006


Hi, 
 
> Von: Brad King <brad.king at kitware.com> 
>  
> Alexander Neundorf wrote: 
> > 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 ?  
>  
> We've used 
>  
> IF("${CMAKE_C_COMPILER}" MATCHES "^cl$") 
>  
> and this should work for you for now, but... 
 
Sure ? This one seems to be set to: 
D:/Programme/Microsoft Visual Studio 8/VC/bin/cl.exe 
So I'd go with  
IF(CMAKE_C_COMPILER MATCHES "cl\\.exe") 
Why did you actually enclose the CMAKE_C_COMPILER in "..." ? 
 
See here: 
http://lists.kde.org/?l=kde-core-devel&m=113854399503911&w=2 
 
This has been generated using this script:

http://websvn.kde.org/trunk/KDE/kdelibs/cmake/systeminfo/CMakeLists.txt?rev=503587&view=auto

  
> > Or how about adding a "MSVC" to the list above ?  
>  
> There needs to be a whole compiler id step added to do this right.  It  
> can probably be integrated with the checks for a working compiler, but  
> this has not yet been done.  It's been on my to-do list for a long 
> time. 
 
Can they simply be added to the files in Modules/Platforms/ ? 
 
Bye 
Alex 
 

-- 
DSL-Aktion wegen großer Nachfrage bis 28.2.2006 verlängert:
GMX DSL-Flatrate 1 Jahr kostenlos* http://www.gmx.net/de/go/dsl


More information about the CMake mailing list