Skip to content

Commit 8507a16

Browse files
committed
build: fix detection of Visual Studio 2019
When run in a Visual Studio 2019 command prompt the `VCINSTALLDIR` environment variable will be already set and is not cleared by the `tools/msvs/vswhere_usability_wrapper.cmd` utility when it fails to find Visual Studio 2017.
1 parent 9779eec commit 8507a16

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

vcbuild.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ if %target_arch%==x86 if %msvs_host_arch%==x86 set vcvarsall_arg=x86
243243
:vs-set-2017
244244
if defined target_env if "%target_env%" NEQ "vs2017" goto vs-set-2019
245245
echo Looking for Visual Studio 2017
246+
@rem VCINSTALLDIR may be set if run from a VS Command Prompt and needs to be
247+
@rem cleared first as vswhere_usability_wrapper.cmd doesn't when it fails to
248+
@rem detect the version searched for
249+
if not defined target_env set "VCINSTALLDIR="
246250
call tools\msvs\vswhere_usability_wrapper.cmd "[15.0,16.0)"
247251
if "_%VCINSTALLDIR%_" == "__" goto msbuild-not-found
248252
if defined msi (

0 commit comments

Comments
 (0)