MarkSchofield / WindowsToolchain

A repository containing a CMake toolchain for using MSVC
MIT License
106 stars 19 forks source link

Fix 'VS_PLATFORM_TOOLSET_VERSION' logic for setting the toolset version #80

Closed MarkSchofield closed 1 year ago

MarkSchofield commented 1 year ago

Windows.MSVC.toolchain.cmake has incorrect logic for configuring the toolset version to use:

https://github.com/MarkSchofield/WindowsToolchain/blob/70d0c2bb086534565e4193ce034fe38588a4b932/Windows.MSVC.toolchain.cmake#L134C1-L140C83

It checks VS_PLATFORM_TOOLSET_VERSION but never uses the value, it uses VS_TOOLSET_VERSION instead. This change switches to use VS_PLATFORM_TOOLSET_VERSION (which aligns with CMake's CMAKE_VS_PLATFORM_TOOLSET_VERSION), and then sets CMAKE_VS_PLATFORM_TOOLSET_VERSION with the resolved value.

At the minute VS_PLATFORM_TOOLSET_VERSION has to be an exact match - #79 tracks adding support for approximate matches, like vcvarsall.bat does.

This fixes #78.