From 7d1cfc7320e2cec3933609b15b1dbd4d0df37ab1 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 3 Dec 2021 10:16:55 +0100 Subject: [PATCH] fixed msvc versions (#2314) * fixed msvc versions * Update reference/conanfile/tools/cmake/cmaketoolchain.rst Co-authored-by: Carlos Zoido * Update reference/conanfile/tools/cmake/cmaketoolchain.rst Co-authored-by: Luis Martinez Co-authored-by: Carlos Zoido Co-authored-by: Luis Martinez --- .../conanfile/tools/cmake/cmaketoolchain.rst | 2 +- reference/config_files/settings.yml.rst | 34 +++++++++++++------ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/reference/conanfile/tools/cmake/cmaketoolchain.rst b/reference/conanfile/tools/cmake/cmaketoolchain.rst index 3a90d4820fa9..95cbfa9c136a 100644 --- a/reference/conanfile/tools/cmake/cmaketoolchain.rst +++ b/reference/conanfile/tools/cmake/cmaketoolchain.rst @@ -68,7 +68,7 @@ translated from the current ``settings``: generator and the CMake toolchain file. The CMake generator will be deduced from the current Conan compiler settings: - For ``settings.compiler="Visual Studio"``, the CMake generator is a direct mapping of ``compiler.version``, as this version represents the IDE version, not the compiler version. - - For ``settings.compiler=msvc``, the CMake generator will be by default the one of the Visual Studio that introduced this compiler version (``msvc 19.0`` => ``Visual Studio 14``, ``msvc 19.1`` => ``Visual Studio 15``, etc). This can be changed, using the ``tools.microsoft.msbuild:vs_version`` [conf] configuration. If it is defined, that Visual Studio version will be used as the CMake generator, and the specific compiler version and toolset will be defined in the ``conan_toolchain.cmake`` file. + - For ``settings.compiler=msvc``, the applied CMake generator will be, by default, the Visual Studio that introduced the specified `settings.compiler.version`. e.g: (``settings.compiler.version = 190`` => ``Visual Studio 14``, ``settings.compiler.version = 191`` => ``Visual Studio 15``, etc). This can be changed, using the ``tools.microsoft.msbuild:vs_version`` [conf] configuration. If it is defined, that Visual Studio version will be used as the CMake generator, and the specific compiler version and toolset will be defined in the ``conan_toolchain.cmake`` file.. - *conanvcvars.bat*: In some cases, the Visual Studio environment needs to be defined correctly for building, like when using the Ninja or NMake generators. If necessary, the ``CMakeToolchain`` will generate this script, diff --git a/reference/config_files/settings.yml.rst b/reference/config_files/settings.yml.rst index 54720b8c36a4..89c41fc4e487 100644 --- a/reference/config_files/settings.yml.rst +++ b/reference/config_files/settings.yml.rst @@ -81,12 +81,11 @@ are possible. These are the **default** values, but it is possible to customize llvm, ClangCL] cppstd: [None, 14, 17, 20] msvc: - version: ["19.0", - "19.1", "19.10", "19.11", "19.12", "19.13", "19.14", "19.15", "19.16", - "19.2", "19.20", "19.21", "19.22", "19.23", "19.24", "19.25", "19.26", "19.27", "19.28"] + version: [190, 191, 192, 193] + update: [None, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] runtime: [static, dynamic] runtime_type: [Debug, Release] - cppstd: [14, 17, 20] + cppstd: [14, 17, 20, 23] clang: version: ["3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "4.0", "5.0", "6.0", "7.0", "7.1", @@ -169,7 +168,7 @@ msvc The new ``msvc`` compiler is a new, **experimental** one, that is intended to deprecate the ``Visual Studio`` one in Conan 2.0: -- It uses the compiler version, that is 19.0, 19.1, etc, instead of the Visual Studio IDE (15, 16, etc). +- It uses the compiler version, that is 190 (19.0), 191 (19.1), etc, instead of the Visual Studio IDE (15, 16, etc). - It is only used by the new build integrations in :ref:`conan_tools_cmake` and :ref:`conan_tools_microsoft`, but not the previous ones. - At the moment it implements a ``compatible_packages`` fallback to Visual Studio compiled packages, that is, previous existing binaries compiled with ``settings.compiler="Visual Studio"`` can be used for the ``msvc`` compiler if no binaries exist for it yet. @@ -179,9 +178,9 @@ The new ``msvc`` compiler is a new, **experimental** one, that is intended to de When using the ``msvc`` compiler, the Visual Studio toolset version (the actual ``vcvars`` activation and ``MSBuild`` location) will be defined by the default provide of that compiler version: -- ``msvc`` compiler version '19.0': Visual Studio 14 2015 -- ``msvc`` compiler version '19.1': Visual Studio 15 2017 -- ``msvc`` compiler version '19.2': Visual Studio 16 2019 +- ``msvc`` compiler version '190': Visual Studio 14 2015 +- ``msvc`` compiler version '191': Visual Studio 15 2017 +- ``msvc`` compiler version '192': Visual Studio 16 2019 This can be configured in your profiles with the ``tools.microsoft.msbuild:vs_version`` configuration: @@ -189,15 +188,30 @@ This can be configured in your profiles with the ``tools.microsoft.msbuild:vs_ve [settings] compiler=msvc - compiler.version=19.0 + compiler.version=190 [conf] tools.microsoft.msbuild:vs_version = 16 -In this case, the ``vcvars`` will activate the Visual Studio 16 installation, but the ``19.0`` compiler version will still be used +In this case, the ``vcvars`` will activate the Visual Studio 16 installation, but the ``190`` compiler version will still be used because the necessary ``toolset=v140`` will be set. +The settings define the last digit ``update: [None, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]``, which by default is ``None``, means that Conan +assumes binary compatibility for the compiler patches, which works in general for the Microsoft compilers. For cases where finer +control is desired, you can just add the ``update`` part to your profiles: + +.. code-block:: text + + [settings] + compiler=msvc + compiler.version=191 + compiler.version.update=3 + + +This will be equivalent to the full version ``1913 (19.13)``. If even further details is desired, you could even add your own digits +to the ``update`` subsetting in ``settings.yml``. + clang +++++