[CMake] recommended way to test for msvc/cl ?
Brad King
brad.king at kitware.com
Mon Jan 30 14:09:34 EST 2006
Alexander Neundorf wrote:
>>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")
Actually I think the case I'm remembering is
IF("${CMAKE_C_COMPILER}" MATCHES "cl")
but that is probably not too reliable.
> Why did you actually enclose the CMAKE_C_COMPILER in "..." ?
I was using the "string MATCHES string" form of the IF statement because
we are trying to move away from the confusing "var MATCHES string" form.
If the variable is empty the double-quotes ensure the first argument
is still a string and the syntax remains valid.
>>>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/ ?
Of course, that is a simple solution. Each of those files should set a
variable to indicate it has been loaded. I'll make this change. The
compiler-id step should still eventually be implemented to more
carefully choose which of these files to load.
-Brad
More information about the CMake
mailing list