diff --git a/conan/tools/_compilers.py b/conan/tools/_compilers.py index e61743901ff..7e1e8b745b7 100644 --- a/conan/tools/_compilers.py +++ b/conan/tools/_compilers.py @@ -181,13 +181,13 @@ def _cppstd_msvc(visual_version, cppstd): v20 = None v23 = None - if Version(visual_version) >= "19.0": + if Version(visual_version) >= "190": v14 = "c++14" v17 = "c++latest" - if Version(visual_version) >= "19.1": + if Version(visual_version) >= "191": v17 = "c++17" v20 = "c++latest" - if Version(visual_version) >= "19.3": + if Version(visual_version) >= "193": v20 = "c++20" v23 = "c++latest" diff --git a/conan/tools/cmake/toolchain.py b/conan/tools/cmake/toolchain.py index 7831dadeae4..eb44faafd13 100644 --- a/conan/tools/cmake/toolchain.py +++ b/conan/tools/cmake/toolchain.py @@ -535,14 +535,12 @@ def _get_toolset(self, generator): return IntelCC(self._conanfile).ms_toolset elif compiler == "msvc": compiler_version = str(settings.compiler.version) - version_components = compiler_version.split(".") - if len(version_components) >= 2: # there is a 19.XX - minor = version_components[1] - if len(minor) >= 2 and "X" not in minor: # It is full one(19.28), not generic 19.2X - # The equivalent of compiler 19.26 is toolset 14.26 - return "version=14.{}".format(minor) - else: - return "v14{}".format(minor[0]) + compiler_update = str(settings.compiler.update) + if compiler_update != "None": # It is full one(19.28), not generic 19.2X + # The equivalent of compiler 19.26 is toolset 14.26 + return "version=14.{}{}".format(compiler_version[-1], compiler_update) + else: + return "v14{}".format(compiler_version[-1]) elif compiler == "clang": if generator and "Visual" in generator: if "Visual Studio 16" in generator: diff --git a/conan/tools/microsoft/toolchain.py b/conan/tools/microsoft/toolchain.py index 84399817c16..ec29c6bafde 100644 --- a/conan/tools/microsoft/toolchain.py +++ b/conan/tools/microsoft/toolchain.py @@ -9,26 +9,6 @@ from conans.util.files import save, load -def vs_ide_version(conanfile): - compiler = conanfile.settings.get_safe("compiler") - compiler_version = (conanfile.settings.get_safe("compiler.base.version") or - conanfile.settings.get_safe("compiler.version")) - if compiler == "msvc": - toolset_override = conanfile.conf["tools.microsoft.msbuild:vs_version"] - if toolset_override: - visual_version = toolset_override - else: - version = compiler_version[:4] # Remove the latest version number 19.1X if existing - _visuals = {'19.0': '14', # TODO: This is common to CMake, refactor - '19.1': '15', - '19.2': '16', - '19.3': '17'} - visual_version = _visuals[version] - else: - visual_version = compiler_version - return visual_version - - class MSBuildToolchain(object): filename = "conantoolchain.props" @@ -69,12 +49,11 @@ def _msvs_toolset(conanfile): compiler = settings.get_safe("compiler") compiler_version = settings.get_safe("compiler.version") if compiler == "msvc": - version = compiler_version[:4] # Remove the latest version number 19.1X if existing - toolsets = {'19.0': 'v140', # TODO: This is common to CMake, refactor - '19.1': 'v141', - '19.2': 'v142', - "19.3": 'v143'} - return toolsets[version] + toolsets = {'190': 'v140', # TODO: This is common to CMake, refactor + '191': 'v141', + '192': 'v142', + "193": 'v143'} + return toolsets[compiler_version] if compiler == "intel": compiler_version = compiler_version if "." in compiler_version else \ "%s.0" % compiler_version diff --git a/conan/tools/microsoft/visual.py b/conan/tools/microsoft/visual.py index 2c1b1d420d7..6f758fb650e 100644 --- a/conan/tools/microsoft/visual.py +++ b/conan/tools/microsoft/visual.py @@ -7,6 +7,14 @@ CONAN_VCVARS_FILE = "conanvcvars.bat" +def msvc_version_to_vs_ide_version(version): + _visuals = {'190': '14', + '191': '15', + '192': '16', + '193': '17'} + return _visuals[str(version)] + + class VCVars: def __init__(self, conanfile): self._conanfile = conanfile @@ -54,12 +62,7 @@ def vs_ide_version(conanfile): if toolset_override: visual_version = toolset_override else: - version = compiler_version[:4] # Remove the latest version number 19.1X if existing - _visuals = {'19.0': '14', # TODO: This is common to CMake, refactor - '19.1': '15', - '19.2': '16', - '19.3': '17'} - visual_version = _visuals[version] + visual_version = msvc_version_to_vs_ide_version(compiler_version) else: visual_version = compiler_version return visual_version @@ -166,9 +169,6 @@ def _vcvars_vers(conanfile, compiler, vs_version): assert compiler == "msvc" # Code similar to CMakeToolchain toolset one compiler_version = str(conanfile.settings.compiler.version) - version_components = compiler_version.split(".") - assert len(version_components) >= 2 # there is a 19.XX - minor = version_components[1] - # The equivalent of compiler 19.26 is toolset 14.26 - vcvars_ver = "14.{}".format(minor[0]) + # The equivalent of compiler 192 is toolset 14.2 + vcvars_ver = "14.{}".format(compiler_version[-1]) return vcvars_ver diff --git a/conans/client/build/cppstd_flags.py b/conans/client/build/cppstd_flags.py index 36e46ca5612..9b96ce7cd72 100644 --- a/conans/client/build/cppstd_flags.py +++ b/conans/client/build/cppstd_flags.py @@ -126,13 +126,13 @@ def _cppstd_msvc(visual_version, cppstd): v20 = None v23 = None - if Version(visual_version) >= "19.0": + if Version(visual_version) >= "190": v14 = "c++14" v17 = "c++latest" - if Version(visual_version) >= "19.1": + if Version(visual_version) >= "191": v17 = "c++17" v20 = "c++latest" - if Version(visual_version) >= "19.3": + if Version(visual_version) >= "193": v20 = "c++20" v23 = "c++latest" diff --git a/conans/client/conf/__init__.py b/conans/client/conf/__init__.py index 824bc44b81f..5b73da766e2 100644 --- a/conans/client/conf/__init__.py +++ b/conans/client/conf/__init__.py @@ -92,10 +92,8 @@ llvm, ClangCL, v143] cppstd: [None, 14, 17, 20, 23] msvc: - version: ["19.0", - "19.1X", "19.10", "19.11", "19.12", "19.13", "19.14", "19.15", "19.16", - "19.2X", "19.20", "19.21", "19.22", "19.23", "19.24", "19.25", "19.26", "19.27", "19.28", "19.29", - "19.3X", "19.30"] + 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, 23] diff --git a/conans/client/conf/detect.py b/conans/client/conf/detect.py index 005604fee20..3539623a739 100644 --- a/conans/client/conf/detect.py +++ b/conans/client/conf/detect.py @@ -161,9 +161,7 @@ def _get_profile_compiler_version(compiler, version, output): elif compiler == "intel" and (int(major) < 19 or (int(major) == 19 and int(minor) == 0)): return major elif compiler == "msvc": - # by default, drop the last digit of the minor (19.30 -> 19.3) - if len(minor) == 2: - version = version[:-1] + return major return version @@ -233,7 +231,7 @@ def _detect_compiler_version(result, output, profile_path): version = Version(version) if version == "17": compiler = "msvc" - version = "19.3" + version = "193" result.append(("compiler", compiler)) result.append(("compiler.version", _get_profile_compiler_version(compiler, version, output))) diff --git a/conans/client/migrations_settings.py b/conans/client/migrations_settings.py index c599020dabe..c02099d2d14 100644 --- a/conans/client/migrations_settings.py +++ b/conans/client/migrations_settings.py @@ -2906,10 +2906,8 @@ llvm, ClangCL, v143] cppstd: [None, 14, 17, 20, 23] msvc: - version: ["19.0", - "19.1X", "19.10", "19.11", "19.12", "19.13", "19.14", "19.15", "19.16", - "19.2X", "19.20", "19.21", "19.22", "19.23", "19.24", "19.25", "19.26", "19.27", "19.28", "19.29", - "19.3X", "19.30"] + 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, 23] diff --git a/conans/model/info.py b/conans/model/info.py index 9fa054a81d9..c61ea3db058 100644 --- a/conans/model/info.py +++ b/conans/model/info.py @@ -1,5 +1,6 @@ import os +from conan.tools.microsoft.visual import msvc_version_to_vs_ide_version from conans.client.build.cppstd_flags import cppstd_default from conans.client.tools.win import MSVS_DEFAULT_TOOLSETS_INVERSE from conans.errors import ConanException @@ -587,12 +588,8 @@ def msvc_compatible(self): runtime_type = compatible.settings.compiler.runtime_type compatible.settings.compiler = "Visual Studio" - version = str(version)[:4] - _visuals = {'19.0': '14', - '19.1': '15', - '19.2': '16', - '19.3': '17'} - compatible.settings.compiler.version = _visuals[version] + visual_version = msvc_version_to_vs_ide_version(version) + compatible.settings.compiler.version = visual_version runtime = "MT" if runtime == "static" else "MD" if runtime_type == "Debug": runtime = "{}d".format(runtime) diff --git a/conans/test/functional/toolchains/cmake/test_cmake.py b/conans/test/functional/toolchains/cmake/test_cmake.py index 92f21907b9d..3dac85f7388 100644 --- a/conans/test/functional/toolchains/cmake/test_cmake.py +++ b/conans/test/functional/toolchains/cmake/test_cmake.py @@ -174,8 +174,8 @@ def _run_app(self, build_type, bin_folder=False, msg="App", dyld_path=None): class WinTest(Base): @parameterized.expand([("Visual Studio", "Debug", "MTd", "15", "14", "x86", "v140", True), ("Visual Studio", "Release", "MD", "15", "17", "x86_64", "", False), - ("msvc", "Debug", "static", "19.1X", "14", "x86", None, True), - ("msvc", "Release", "dynamic", "19.1X", "17", "x86_64", None, False)] + ("msvc", "Debug", "static", "191", "14", "x86", None, True), + ("msvc", "Release", "dynamic", "191", "17", "x86_64", None, False)] ) def test_toolchain_win(self, compiler, build_type, runtime, version, cppstd, arch, toolset, shared): @@ -244,7 +244,7 @@ def _verify_out(marker=">>"): if compiler == "msvc": visual_version = version else: - visual_version = "19.0" if toolset == "v140" else "19.1" + visual_version = "190" if toolset == "v140" else "191" check_exe_run(self.client.out, "main", "msvc", visual_version, "Release", arch, cppstd, {"MYVAR": "MYVAR_VALUE", "MYVAR_CONFIG": "MYVAR_RELEASE", @@ -448,8 +448,8 @@ def _verify_out(marker=">>"): @pytest.mark.skipif(platform.system() != "Windows", reason="Only for windows") @pytest.mark.parametrize("version, vs_version", - [("19.0", "15"), - ("19.1X", "15")]) + [("190", "15"), + ("191", "15")]) def test_msvc_vs_versiontoolset(version, vs_version): settings = {"compiler": "msvc", "compiler.version": version, diff --git a/conans/test/functional/toolchains/cmake/test_cmake_toolchain.py b/conans/test/functional/toolchains/cmake/test_cmake_toolchain.py index b05cb2c3fa7..f8f31463ba2 100644 --- a/conans/test/functional/toolchains/cmake/test_cmake_toolchain.py +++ b/conans/test/functional/toolchains/cmake/test_cmake_toolchain.py @@ -12,14 +12,15 @@ @pytest.mark.skipif(platform.system() != "Windows", reason="Only for windows") -@pytest.mark.parametrize("compiler, version, runtime", - [("msvc", "19.2X", "dynamic"), - ("msvc", "19.26", "static"), - ("msvc", "19.28", "static")]) -def test_cmake_toolchain_win_toolset(compiler, version, runtime): +@pytest.mark.parametrize("compiler, version, update, runtime", + [("msvc", "192", None, "dynamic"), + ("msvc", "192", "6", "static"), + ("msvc", "192", "8", "static")]) +def test_cmake_toolchain_win_toolset(compiler, version, update, runtime): client = TestClient(path_with_spaces=False) settings = {"compiler": compiler, "compiler.version": version, + "compiler.update": update, "compiler.cppstd": "17", "compiler.runtime": runtime, "build_type": "Release", @@ -34,11 +35,10 @@ def test_cmake_toolchain_win_toolset(compiler, version, runtime): client.save({"conanfile.py": conanfile}) client.run("install . {}".format(settings)) toolchain = client.load("conan_toolchain.cmake") - if "X" not in version: # Fullversion - minor = version.split(".")[1] - value = "version=14.{}".format(minor) + if update is not None: # Fullversion + value = "version=14.{}{}".format(version[-1], update) else: - value = "v142" + value = "v14{}".format(version[-1]) assert 'set(CMAKE_GENERATOR_TOOLSET "{}" CACHE STRING "" FORCE)'.format(value) in toolchain diff --git a/conans/test/functional/toolchains/cmake/test_ninja.py b/conans/test/functional/toolchains/cmake/test_ninja.py index 0461fea3b9d..680b4b2ee5f 100644 --- a/conans/test/functional/toolchains/cmake/test_ninja.py +++ b/conans/test/functional/toolchains/cmake/test_ninja.py @@ -123,7 +123,7 @@ def test_locally_build_msvc_toolset(client): [settings] os=Windows compiler=msvc - compiler.version=19.0 + compiler.version=190 compiler.runtime=dynamic compiler.cppstd=14 build_type=Release @@ -144,7 +144,7 @@ def test_locally_build_msvc_toolset(client): client.run_command("myapp.exe") # Checking that compiler is indeed version 19.0, not 19.1-default of VS15 - check_exe_run(client.out, ["main", "hello"], "msvc", "19.0", "Release", "x86_64", cppstd="14") + check_exe_run(client.out, ["main", "hello"], "msvc", "190", "Release", "x86_64", cppstd="14") check_vs_runtime("myapp.exe", client, msvc_version, "Release", architecture="amd64") check_vs_runtime("mylibrary.lib", client, msvc_version, "Release", architecture="amd64") @@ -203,7 +203,7 @@ def test_ninja_conf(): [settings] os=Windows compiler=msvc - compiler.version=19.1X + compiler.version=191 compiler.runtime=dynamic compiler.cppstd=14 build_type=Release diff --git a/conans/test/functional/toolchains/microsoft/test_msbuild.py b/conans/test/functional/toolchains/microsoft/test_msbuild.py index 92bcb9161b1..395009dc054 100644 --- a/conans/test/functional/toolchains/microsoft/test_msbuild.py +++ b/conans/test/functional/toolchains/microsoft/test_msbuild.py @@ -307,13 +307,13 @@ @pytest.mark.tool_visual_studio(version='15') @pytest.mark.skipif(platform.system() != "Windows", reason="Only for windows") def test_msvc_runtime_flag_vs2017(): - check_msvc_runtime_flag("15", "19.1X") + check_msvc_runtime_flag("15", "191") @pytest.mark.tool_visual_studio(version='17') @pytest.mark.skipif(platform.system() != "Windows", reason="Only for windows") def test_msvc_runtime_flag_vs2022(): - check_msvc_runtime_flag("17", "19.3X") + check_msvc_runtime_flag("17", "193") def check_msvc_runtime_flag(vs_version, msvc_version): @@ -342,10 +342,10 @@ def generate(self): assert "MSVC FLAG=MD!!" in client.out -vs_versions = [{"vs_version": "15", "msvc_version": "19.1X", "ide_year": "2017", "toolset": "v141"}] +vs_versions = [{"vs_version": "15", "msvc_version": "191", "ide_year": "2017", "toolset": "v141"}] if "17" in tools_locations['visual_studio'] and not tools_locations['visual_studio']['17'].get('disabled', False): - vs_versions.append({"vs_version": "17", "msvc_version": "19.3X", "ide_year": "2022", "toolset": "v143"}) + vs_versions.append({"vs_version": "17", "msvc_version": "193", "ide_year": "2022", "toolset": "v143"}) @parameterized_class(vs_versions) @@ -422,8 +422,8 @@ def _run_app(client, arch, build_type, shared=None): client.run_command(command_str) @parameterized.expand([("Visual Studio", "15", "MT", "17"), - ("msvc", "19.1X", "static", "17"), - ("msvc", "19.0", "static", "14")] + ("msvc", "191", "static", "17"), + ("msvc", "190", "static", "14")] ) @pytest.mark.tool_cmake def test_toolchain_win_vs2017(self, compiler, version, runtime, cppstd): @@ -433,7 +433,7 @@ def test_toolchain_win_vs2017(self, compiler, version, runtime, cppstd): self.check_toolchain_win(compiler, version, runtime, cppstd) @parameterized.expand([("Visual Studio", "17", "MT", "17"), - ("msvc", "19.3", "static", "17")] + ("msvc", "193", "static", "17")] ) def test_toolchain_win_vs2022(self, compiler, version, runtime, cppstd): if self.vs_version != "17": @@ -526,7 +526,7 @@ def test_toolchain_win_debug(self): self.assertIn("[vcvarsall.bat] Environment initialized for: 'x64'", client.out) self._run_app(client, "x64", "Debug") self.assertIn("Hello World Debug", client.out) - check_exe_run(client.out, "main", "msvc", "19.0", "Debug", "x86_64", "14", + check_exe_run(client.out, "main", "msvc", "190", "Debug", "x86_64", "14", {"DEFINITIONS_BOTH": 'True', "DEFINITIONS_BOTH2": "True", "DEFINITIONS_BOTH_INT": "123", diff --git a/conans/test/functional/toolchains/microsoft/test_msbuilddeps.py b/conans/test/functional/toolchains/microsoft/test_msbuilddeps.py index 63b60e1ff63..426278b9abf 100644 --- a/conans/test/functional/toolchains/microsoft/test_msbuilddeps.py +++ b/conans/test/functional/toolchains/microsoft/test_msbuilddeps.py @@ -398,7 +398,7 @@ """ -vs_versions = [{"vs_version": "15", "msvc_version": "19.1", "ide_year": "2017", "toolset": "v141"}] +vs_versions = [{"vs_version": "15", "msvc_version": "191", "ide_year": "2017", "toolset": "v141"}] if "17" in tools_locations['visual_studio'] and not tools_locations['visual_studio']['17'].get('disabled', False): vs_versions.append({"vs_version": "17", "msvc_version": "19.3", "ide_year": "2022", "toolset": "v143"}) diff --git a/conans/test/functional/toolchains/test_msbuild_toolchain.py b/conans/test/functional/toolchains/test_msbuild_toolchain.py index 4cc3b3808be..b6869796d98 100644 --- a/conans/test/functional/toolchains/test_msbuild_toolchain.py +++ b/conans/test/functional/toolchains/test_msbuild_toolchain.py @@ -7,8 +7,8 @@ from conans.test.utils.tools import TestClient -@parameterized.expand([("msvc", "19.0", "dynamic"), - ("msvc", "19.1X", "static")] +@parameterized.expand([("msvc", "190", "dynamic"), + ("msvc", "191", "static")] ) @pytest.mark.tool_visual_studio @pytest.mark.skipif(platform.system() != "Windows", reason="Only for windows") @@ -37,7 +37,7 @@ def generate(self): client.run("install . {}".format(settings)) props = client.load("conantoolchain_release_x64.props") assert "stdcpp17" in props - if version == "19.0": + if version == "190": assert "v140" in props else: assert "v141" in props diff --git a/conans/test/functional/utils.py b/conans/test/functional/utils.py index 5e2edd35ace..9fe753eabe5 100644 --- a/conans/test/functional/utils.py +++ b/conans/test/functional/utils.py @@ -44,7 +44,7 @@ def check_exe_run(output, names, compiler, version, build_type, arch, cppstd, de assert arch is None, "checked don't know how to validate this architecture" if version: - assert "{} _MSC_VER{}".format(name, version.replace(".", "").replace("X", "")) in output + assert "{} _MSC_VER{}".format(name, version) in output if cppstd: assert "{} _MSVC_LANG20{}".format(name, cppstd) in output diff --git a/conans/test/integration/package_id/compatible_test.py b/conans/test/integration/package_id/compatible_test.py index 615fb4785db..e34d0c6223b 100644 --- a/conans/test/integration/package_id/compatible_test.py +++ b/conans/test/integration/package_id/compatible_test.py @@ -531,7 +531,7 @@ def test_msvc_visual_incompatible(): [settings] os=Windows compiler=msvc - compiler.version=19.1X + compiler.version=191 compiler.runtime=dynamic compiler.cppstd=14 build_type=Release diff --git a/conans/test/integration/toolchains/microsoft/vcvars_test.py b/conans/test/integration/toolchains/microsoft/vcvars_test.py index b0f9253e252..8b9136a0ce8 100644 --- a/conans/test/integration/toolchains/microsoft/vcvars_test.py +++ b/conans/test/integration/toolchains/microsoft/vcvars_test.py @@ -24,7 +24,7 @@ def generate(self): """.format('scope="{}"'.format(scope) if scope else "")) client.save({"conanfile.py": conanfile}) - client.run('install . -s os=Windows -s compiler="msvc" -s compiler.version=19.1X ' + client.run('install . -s os=Windows -s compiler="msvc" -s compiler.version=191 ' '-s compiler.cppstd=14 -s compiler.runtime=static') assert os.path.exists(os.path.join(client.current_folder, "conanvcvars.bat")) @@ -47,7 +47,7 @@ class TestConan(ConanFile): settings = "os", "compiler", "arch", "build_type" """) client.save({"conanfile.py": conanfile}) - client.run('install . -s os=Windows -s compiler="msvc" -s compiler.version=19.1X ' + client.run('install . -s os=Windows -s compiler="msvc" -s compiler.version=191 ' '-s compiler.cppstd=14 -s compiler.runtime=static') assert os.path.exists(os.path.join(client.current_folder, "conanvcvars.bat")) @@ -65,7 +65,7 @@ class TestConan(ConanFile): settings = "os", "compiler", "arch", "build_type" """) client.save({"conanfile.py": conanfile}) - client.run('install . -s os=Windows -s compiler="msvc" -s compiler.version=19.0 ' + client.run('install . -s os=Windows -s compiler="msvc" -s compiler.version=190 ' '-s compiler.cppstd=14 -s compiler.runtime=static') vcvars = client.load("conanvcvars.bat") diff --git a/conans/test/unittests/client/toolchain/autotools/autotools_toolchain_test.py b/conans/test/unittests/client/toolchain/autotools/autotools_toolchain_test.py index f75db39f92a..4c1867713f8 100644 --- a/conans/test/unittests/client/toolchain/autotools/autotools_toolchain_test.py +++ b/conans/test/unittests/client/toolchain/autotools/autotools_toolchain_test.py @@ -100,7 +100,7 @@ def test_cppstd(): {"build_type": "Release", "arch": "x86", "compiler": "msvc", - "compiler.version": "19.3", + "compiler.version": "193", "compiler.cppstd": "17"}) be = AutotoolsToolchain(conanfile) env = be.vars() diff --git a/conans/test/unittests/tools/cmake/test_cmaketoolchain.py b/conans/test/unittests/tools/cmake/test_cmaketoolchain.py index dbce10f3d8f..4a0032d95a6 100644 --- a/conans/test/unittests/tools/cmake/test_cmaketoolchain.py +++ b/conans/test/unittests/tools/cmake/test_cmaketoolchain.py @@ -175,13 +175,14 @@ def conanfile_msvc(): c = ConanFile(Mock(), None) c.settings = "os", "compiler", "build_type", "arch" c.initialize(Settings({"os": ["Windows"], - "compiler": {"msvc": {"version": ["19.3X"], "cppstd": ["20"]}}, + "compiler": {"msvc": {"version": ["193"], "update": [None], + "cppstd": ["20"]}}, "build_type": ["Release"], "arch": ["x86"]}), EnvValues()) c.settings.build_type = "Release" c.settings.arch = "x86" c.settings.compiler = "msvc" - c.settings.compiler.version = "19.3X" + c.settings.compiler.version = "193" c.settings.compiler.cppstd = "20" c.settings.os = "Windows" c.conf = Conf() diff --git a/conans/test/unittests/tools/microsoft/test_msbuild.py b/conans/test/unittests/tools/microsoft/test_msbuild.py index 06972b4d9c7..bd69ab7cc2e 100644 --- a/conans/test/unittests/tools/microsoft/test_msbuild.py +++ b/conans/test/unittests/tools/microsoft/test_msbuild.py @@ -37,7 +37,7 @@ def test_msbuild_cpu_count(): def test_msbuild_toolset(): settings = Settings({"build_type": ["Release"], - "compiler": {"msvc": {"version": ["19.3"]}}, + "compiler": {"msvc": {"version": ["193"]}}, "os": ["Windows"], "arch": ["x86_64"]}) conanfile = ConanFile(Mock(), None) @@ -45,7 +45,7 @@ def test_msbuild_toolset(): conanfile.initialize(settings, EnvValues()) conanfile.settings.build_type = "Release" conanfile.settings.compiler = "msvc" - conanfile.settings.compiler.version = "19.3" + conanfile.settings.compiler.version = "193" conanfile.settings.os = "Windows" conanfile.settings.arch = "x86_64" @@ -61,7 +61,7 @@ def test_msbuild_toolset(): def test_msbuild_toolset_for_intel_cc(mode, expected_toolset): settings = Settings({"build_type": ["Release"], "compiler": {"intel-cc": {"version": ["2021.3"], "mode": [mode]}, - "msvc": {"version": ["19.3"], "cppstd": ["20"]}}, + "msvc": {"version": ["193"], "cppstd": ["20"]}}, "os": ["Windows"], "arch": ["x86_64"]}) conanfile = ConanFile(Mock(), None) @@ -82,7 +82,7 @@ def test_msbuild_standard(): test_folder = temp_folder() settings = Settings({"build_type": ["Release"], - "compiler": {"msvc": {"version": ["19.3"], "cppstd": ["20"]}}, + "compiler": {"msvc": {"version": ["193"], "cppstd": ["20"]}}, "os": ["Windows"], "arch": ["x86_64"]}) conanfile = ConanFile(Mock(), None) @@ -94,7 +94,7 @@ def test_msbuild_standard(): conanfile.initialize(settings, EnvValues()) conanfile.settings.build_type = "Release" conanfile.settings.compiler = "msvc" - conanfile.settings.compiler.version = "19.3" + conanfile.settings.compiler.version = "193" conanfile.settings.compiler.cppstd = "20" conanfile.settings.os = "Windows" conanfile.settings.arch = "x86_64" @@ -109,7 +109,7 @@ def test_resource_compile(): test_folder = temp_folder() settings = Settings({"build_type": ["Release"], - "compiler": {"msvc": {"version": ["19.3"], "cppstd": ["20"]}}, + "compiler": {"msvc": {"version": ["193"], "cppstd": ["20"]}}, "os": ["Windows"], "arch": ["x86_64"]}) conanfile = ConanFile(Mock(), None) @@ -122,7 +122,7 @@ def test_resource_compile(): conanfile.initialize(settings, EnvValues()) conanfile.settings.build_type = "Release" conanfile.settings.compiler = "msvc" - conanfile.settings.compiler.version = "19.3" + conanfile.settings.compiler.version = "193" conanfile.settings.compiler.cppstd = "20" conanfile.settings.os = "Windows" conanfile.settings.arch = "x86_64" @@ -151,7 +151,7 @@ def test_msbuild_and_intel_cc_props(mode, expected_toolset): test_folder = temp_folder() settings = Settings({"build_type": ["Release"], "compiler": {"intel-cc": {"version": ["2021.3"], "mode": [mode]}, - "msvc": {"version": ["19.3"], "cppstd": ["20"]}}, + "msvc": {"version": ["193"], "cppstd": ["20"]}}, "os": ["Windows"], "arch": ["x86_64"]}) conanfile = ConanFile(Mock(), None) diff --git a/conans/test/unittests/util/detect_test.py b/conans/test/unittests/util/detect_test.py index 07d23670c7f..1ab8fe9c326 100644 --- a/conans/test/unittests/util/detect_test.py +++ b/conans/test/unittests/util/detect_test.py @@ -101,4 +101,4 @@ def test_vs2022(self): profile_path=DEFAULT_PROFILE_NAME) result = dict(result) self.assertEqual('msvc', result['compiler']) - self.assertEqual('19.3', result['compiler.version']) + self.assertEqual('193', result['compiler.version'])