conanconanfile

How are the msvc compiler versions chosen when configuring a conan profile?


Inside of a conan profile, we can choose a profile to contain,

compiler.version = msvc
compiler.version = 193

Can someone please explain to me how the versioning works for msvc. Inside of the settings.yml I can see the list of possible options,

    msvc:
        version: [170, 180, 190, 191, 192, 193]

However, these are inconsistent with the versioning by Microsoft. As the documentation says, _MSC_VER distinguishes between major and minor releases. It has the form: MMNN.. However when choosing,

compiler=Visual Studio
compiler.version=17

This has a consistent mapping with the previous public releases such as viewing the release history. In short, how did conan come up with these msvc compiler versions?


Solution

  • Conan is using the first 3 digits of the _MSC_VER compiler version for these reasons:

    So using the first 3 digits seemed to fullfill the users requests to use the compiler version instead of the IDE version, and provide a good default binary compatibility for the community (like ConanCenter packages). Conan users that want to model binary compatibility after the 4th digit too can do it by defining the compiler.update=[0-9] setting.