Skip to content

Commit

Permalink
build: fix detection of Visual Studio 2019
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
richardlau committed Mar 15, 2022
1 parent 9779eec commit 8507a16
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ if %target_arch%==x86 if %msvs_host_arch%==x86 set vcvarsall_arg=x86
:vs-set-2017
if defined target_env if "%target_env%" NEQ "vs2017" goto vs-set-2019
echo Looking for Visual Studio 2017
@rem VCINSTALLDIR may be set if run from a VS Command Prompt and needs to be
@rem cleared first as vswhere_usability_wrapper.cmd doesn't when it fails to
@rem detect the version searched for
if not defined target_env set "VCINSTALLDIR="
call tools\msvs\vswhere_usability_wrapper.cmd "[15.0,16.0)"
if "_%VCINSTALLDIR%_" == "__" goto msbuild-not-found
if defined msi (
Expand Down

0 comments on commit 8507a16

Please sign in to comment.