[cmake-developers] The MSVC** version variables

Brad King brad.king at kitware.com
Wed Sep 12 14:57:52 EDT 2012


On 09/12/2012 02:33 PM, Rolf Eike Beer wrote:
> 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?

Always subtract 6 from the "cl" version number to get the IDE version.
This is just a standard VS thing and is not CMake-specific.

> 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)

Starting with VS 2010 the projects support specifying the toolchain
from a different version of VS.  Now that ide-compiler-id is done we
can possibly add support for selecting the compiler in the future.
Therefore the IDE version can be associated only with the IDE
generators, and we already have that from the generator name in
CMAKE_GENERATOR.

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

It would be 14.0.$build or so.  It's the "cl" tool version.

> (Another variable missing on the Wiki)

The Wiki pre-dates the variables section of the reference documentation.
Is it really needed anymore?  Now it just duplicates information.

-Brad



More information about the cmake-developers mailing list