[cmake-developers] The MSVC** version variables

Rolf Eike Beer eike at sf-mail.de
Wed Sep 12 14:33:26 EDT 2012


Brad King wrote:
> On 09/12/2012 02:06 PM, Rolf Eike Beer wrote:
> > I was looking at http://www.cmake.org/Wiki/CMake_Useful_Variables and
> > while
> > scanning through it I once again saw how many variables we have for the
> > different MSVC versions. Since it's unlikely that MSVC11 is the last (the
> > variable is currently missing, but I'll fix that soon) I thought if it
> > wouldn't be enough to just introduce a MSVC_VERSION variable. Setting this
> > to 6.0 or 7.1 or 11 is easy, and checking it is easy since we have
> > VERSION_LESS and friends. Checking for something like "MSVC >= 9.0" is
> > currently a pain if one does not want to fall back to the CL_VERSION,
> > which is not obvious as those versions are of a totally different range
> > and one must always comment on what is checked there.
> > 
> > Patch for this should be trivial. Any opinions?
> 
> There is a MSVC_VERSION variable already.
> 
> Furthermore, since the ide-compiler-id topic was merged recently the
> CMAKE_(C|CXX)_COMPILER_VERSION variables are set.

Ah, hm. Ok, this is the compiler version variable that I knew it would exist 
but did not know how it was named. So this demonstrates exactly what I was 
talking about:

if (MSVC_VERSION VERSION_GREATER 1400)

Without looking in the docs, which MSVC version am I talking about? I would 
propose to name it MSVC_IDE_VERSION then, so this would make it clear to 
everyone:

if (MSVC_IDE_VERSION VERSION_GREATER 8.0)

And from all what I know the CMAKE_CXX_COMPILER_VERSION variable would also 
return 1400 in that case.

(Another variable missing on the Wiki)

Eike
-- 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20120912/e51e1e20/attachment.sig>


More information about the cmake-developers mailing list