Skip to content

Commit 8c69fc3

Browse files
authored
Fixed bug in VS2026 support (#19024)
* Fixed bug in VS2026 support * Added unit test.
1 parent 4bcec39 commit 8c69fc3

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

conan/tools/cmake/toolchain/toolchain.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ def _get_generator(self, recipe_generator):
249249
'14': '14 2015',
250250
'15': '15 2017',
251251
'16': '16 2019',
252-
'17': '17 2022'}
252+
'17': '17 2022',
253+
'18': '18 2026'}
253254

254255
if compiler == "msvc":
255256
if compiler_version is None:

test/unittests/tools/cmake/test_cmaketoolchain.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def test_osx_deployment_target(conanfile_apple):
245245
def conanfile_msvc():
246246
c = ConanFile(None)
247247
c.settings = Settings({"os": ["Windows"],
248-
"compiler": {"msvc": {"version": ["193", "194"], "cppstd": ["20"],
248+
"compiler": {"msvc": {"version": ["193", "194", "195"], "cppstd": ["20"],
249249
"update": [None, 8, 9]}},
250250
"build_type": ["Release"],
251251
"arch": ["x86"]})
@@ -272,6 +272,13 @@ def test_toolset(conanfile_msvc):
272272
assert 'CMAKE_CXX_STANDARD 20' in toolchain.content
273273

274274

275+
def test_toolset_latest_generator(conanfile_msvc):
276+
conanfile_msvc.settings.compiler.version="195"
277+
toolchain = CMakeToolchain(conanfile_msvc)
278+
assert 'set(CMAKE_GENERATOR_TOOLSET "v145" CACHE STRING "" FORCE)' in toolchain.content
279+
assert 'Visual Studio 18 2026' in toolchain.generator
280+
281+
275282
def test_toolset_update_version(conanfile_msvc):
276283
conanfile_msvc.settings.compiler.version = "193"
277284
conanfile_msvc.settings.compiler.update = "8"

0 commit comments

Comments
 (0)