Skip to content

MSVC_VERSION is incorrect when cmake configure project with tool kit clang-cl  #1053

@L-Sun

Description

@L-Sun

Brief Issue Summary

When I configure my project, the cmake variable ${MSVC_VERSION} output incorrectly.
Here is my CMakeLists.txt

cmake_minimum_required(VERSION 3.15)

project(MyProject)

add_executable(main main.cpp)
if(MSVC)
    message("MSVC_VERSION: ${MSVC_VERSION}")
endif(MSVC)

Expected:

  1. run command CMake: Delete Cache and Reconfigure
  2. and Output panel will show:
...
[cmake] MSVC_VERSION: 1924
[cmake]  
[cmake] -- Configuring done
[cmake] -- Generating done

Apparent Behavior:

  1. run command CMake: Delete Cache and Reconfigure
  2. and Output panel show the following message
...
[cmake] MSVC_VERSION: 1911
[cmake]  
[cmake] -- Configuring done
[cmake] -- Generating done

Other Notes/Information

When I add 'VCToolsInstallDir' to MSVC_ENVIRONMENT_VARIABLES array in \.vscode\extensions\ms-vscode.cmake-tools-1.3.0\dist\main.js(or src/kit.ts) of extension.
and reconfigure my project. It works as expected. The cmake variable ${MSVC_VERSION} is correct.

Platform and Versions

  • Operating System: Windows
  • CMake Version: 3.16.4
  • VSCode Version: 1.42.0
  • CMake Tools Extension Version: 1.3.0
  • Compiler/Toolchain: clang-cl (11.0.0) + VS2019 (v16.4.4)
  • visualStudioArchitecture: amd64

Metadata

Metadata

Assignees

No one assigned

    Labels

    buga bug in the product

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions