From 5196d89d2589413c6b5faa51224dc1ff03815878 Mon Sep 17 00:00:00 2001 From: Paul Reeves Date: Tue, 17 Sep 2024 15:36:52 +0200 Subject: [PATCH] Fix #8251 No artifacts produced from windows builds since VS 2022 was upgraded to v17.10 --- builds/win32/setenvvar.bat | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/builds/win32/setenvvar.bat b/builds/win32/setenvvar.bat index dbc80596c1..3e2862411d 100644 --- a/builds/win32/setenvvar.bat +++ b/builds/win32/setenvvar.bat @@ -110,9 +110,19 @@ for %%v in ( %* ) do ( :: Note that VCToolsVersion is only defined after vcvarsall.bat been run. @if defined VCToolsVersion ( set MSVC_RUNTIME_MAJOR_VERSION=%VCToolsVersion:~0,2% - set MSVC_RUNTIME_MINOR_VERSION=%VCToolsVersion:~3,1% - set MSVC_RUNTIME_LIBRARY_VERSION=%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION% set MSVC_RUNTIME_FILE_VERSION=%MSVC_RUNTIME_MAJOR_VERSION%0 +rem NOTE 1 Since the upgrade to VS 17.10.5 this attempt to set the runtime minor +rem version is broken as it now returns '4'. Note also that vcvars.bat has v143 +rem hard-coded. It does not seem to be possible to dynamically derived the minor +rem version using the available env vars so we test to see if the runtime dir +rem exists and if not we fall back to 3. +rem NOTE 2 This code is likely to break again in the future !!!! + set MSVC_RUNTIME_MINOR_VERSION=%VCToolsVersion:~3,1% + if not exist %VCToolsRedistDir%%VSCMD_ARG_TGT_ARCH%\Microsoft.VC%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION%.CRT ( + set MSVC_RUNTIME_MINOR_VERSION=3 + ) + set MSVC_RUNTIME_LIBRARY_VERSION=%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION% + ) @echo.