[CMake] MSVC compiler identification with CMake

François Beaune dictoon at gmail.com
Sat Aug 19 05:31:47 EDT 2017


Hello,

I'm trying to understand the discrepancy between the compiler version
reported by Visual C++ and the compiler version reported by CMake.

I've posted a question on Stack Overflow [1] but since I didn't get a
satisfactory answer yet, I figured I would dig into CMake's sources to
figure it out myself. After an hour of grepping the source code, I'm still
puzzled so I figured I would ask directly here.

FWIW, I'm using Visual Studio Enterprise 2017 version 15.3.0 and CMake
version 3.8.1.

When I run

    cmake -G "Visual Studio 11 2012 Win64" .

I get:

    -- The C compiler identification is MSVC 17.0.60610.1
    -- The CXX compiler identification is MSVC 17.0.60610.1
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft
Visual Studio 11.0/VC/bin/x86_amd64/cl.exe
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft
Visual Studio 11.0/VC/bin/x86_amd64/cl.exe -- works

i.e. the compiler version is 17.0.60610.1. But when I run

    C:\Program Files (x86)\Microsoft Visual Studio
11.0\VC\bin\x86_amd64\cl.exe

I instead get:

    Microsoft (R) C/C++ Optimizing Compiler Version 17.00.50727.1 for x64

i.e. the compiler version is 17.00.50727.1. I'm assuming this is the
correct version number, and I'm now wondering why CMake reports a different
one.

Any idea?

Best,
Franz

[1]
https://stackoverflow.com/questions/45763944/msvc-compiler-identification-with-cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170819/15a81ce7/attachment.html>


More information about the CMake mailing list