Skip to content

Commit d6dd148

Browse files
committed
Yet another attempt
1 parent 5cd5c9f commit d6dd148

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

.github/setup-msvc-env.bat

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
@echo off
22
rem Locate the latest Visual Studio installation that has the VC++ toolchain,
3-
rem then call VsDevCmd.bat to put cl.exe, link.exe, ninja, etc. on PATH.
3+
rem then call vcvarsall.bat to put cl.exe, link.exe, ninja, etc. on PATH.
44
rem
55
rem Usage: call .github\setup-msvc-env.bat
66
rem Must be invoked with CALL so environment changes propagate back to the caller.
7+
rem
8+
rem NOTE: We use vcvarsall.bat (not VsDevCmd.bat) because VsDevCmd.bat is designed
9+
rem for interactive developer shells and can silently skip toolchain PATH setup
10+
rem when called non-interactively from within a script. vcvarsall.bat is the
11+
rem documented and supported way to initialise the MSVC toolchain from automation.
712

813
for /f "usebackq delims=" %%i in (
914
`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" ^
@@ -17,7 +22,7 @@ if "%VSINSTALLDIR%"=="" (
1722
exit /b 1
1823
)
1924

20-
call "%VSINSTALLDIR%\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64
25+
call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" x64
2126

2227
rem Prevent inherited GCC/Clang hints from steering CMake to MinGW.
2328
set "CC="

0 commit comments

Comments
 (0)