[cmake-developers] The MSVC** version variables

David Cole david.cole at kitware.com
Wed Sep 12 15:22:17 EDT 2012


On Wed, Sep 12, 2012 at 3:09 PM, Rolf Eike Beer <eike at sf-mail.de> wrote:
> Brad King wrote:
>> 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 have not said that. But as I did not know until 5 minutes ago someone else
> scanning a CMake file may also not know. So you always need to add a comment.
>
>> > 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.
>
> Do a selection of "MSVC >= 9.0" based on the generator string in one line here
> please:
>
> 1.
>
> :)
>
> Ok, if you don't like the idea, I really don't care about MSVC that much
> anymore. But I wonder why then another MSVCnn variable is introduced for every
> new version of that thing.
>
>> > 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.
>
> Yes, sure. I just have no MSVC around to check ;)
>
>> > (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.
>
> In that case I think bug 12567 should be fixed, the wiki page should be
> cleared and provide just a link to the generated documentation.
>
> I wonder if the CYGWIN and WIN32 variables should then get a hint that their
> behavior changed and which policy was introduced for that.
>
> Eike
> --
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Let's just apply the patch from
http://public.kitware.com/Bug/view.php?id=12567 and then recommend
(strongly) to people that they use the new CMAKE_CXX_COMPILER_VERSION
variable with VERSION_GREATER and friends.

It's usually the compiler version that you need to do checks against,
so that it works regardless of the IDE version being used to drive the
build. (Since VS10, they've added the ability to use other compiler
toolchains, which we are trying to support as well.)



More information about the cmake-developers mailing list