conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
7.96k stars 952 forks source link

[bug] detect_api.detect_msvc_compiler() returns an incorrect version #16577

Closed Todiq closed 2 days ago

Todiq commented 3 days ago

Describe the bug

version: 2.4.1 conan_path: D:\venv\Scripts\conan python version: 3.9.13 sys_version: 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] sys_executable: D:\venv\Scripts\python.exe is_frozen: False architecture: AMD64 system version: 10.0.22631 platform: Windows-10-10.0.22631-SP0 system: Windows release: 10 cpu: Intel64 Family 6 Model 186 Stepping 3, GenuineIntel

How to reproduce it

Hello,

I just noticed that {% set compiler, version, ignored = detect_api.detect_msvc_compiler() %} returns an incorrect compiler version.

In fact, we can observe it in the source code: https://github.com/conan-io/conan/blob/9b4033284c1d4c40270be64c2eed3d85e1d4d454/conan/internal/api/detect_api.py#L535

A VS version >= 17.10 should return a compiler version of 194 instead of 193.

This does not affect detect_api.detect_default_compiler(), which returns 194 as expected.

Could you please have a look?

Thanks for your hard work!

franramirez688 commented 2 days ago

Hi @Todiq

Thanks for reporting this! 👏 https://github.com/conan-io/conan/pull/16581 fixed it. It'll be released in the next Conan v2.5.0 😁