I meant "compile*r* independent..." of course...

David Cole wrote:

Wouldn't it be preferable to remain compile independent as much as possible and avoid CMake blocks that are compiler specific?

Perhaps a TRY_COMPILE would be more appropriate than the "compiler matches regex" test...

You didn't actually say when starting this thread why you wanted to detect the cl compiler. Is it so you can set some compiler specific flags? Or do you have source that is known only to compile with cl? Is CMake missing a feature that requires you to know what compiler is being used?


Just probing for other possible solutions,
David

Alexander Neundorf wrote:

Hi,
Von: Brad King <[EMAIL PROTECTED]>
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

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to