aboutsummaryrefslogtreecommitdiff
path: root/etc/environments/default-msvc.bat
diff options
context:
space:
mode:
Diffstat (limited to 'etc/environments/default-msvc.bat')
-rw-r--r--etc/environments/default-msvc.bat16
1 files changed, 13 insertions, 3 deletions
diff --git a/etc/environments/default-msvc.bat b/etc/environments/default-msvc.bat
index fcb3155..381dc73 100644
--- a/etc/environments/default-msvc.bat
+++ b/etc/environments/default-msvc.bat
@@ -8,6 +8,11 @@ rem
rem Environment setup script for C/C++ compilation with Visual Studio.
rem
+rem If the MSVC and VCVARS variables are set, then set up the environment via
+rem the MSVC command prompt rather than letting build2 find the default.
+rem
+rem Note also that MSVC_VER must always be set.
+
rem set "MSVC=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
rem set "MSVC_VER=14.1"
@@ -25,8 +30,9 @@ setlocal EnableExtensions EnableDelayedExpansion
rem Based on target determine what we are building.
rem
+set "VCVARS="
if "_%1_" == "_x86_64-microsoft-win32-msvc%MSVC_VER%_" (
- set "VCVARS=%VCVARS64%"
+ rem set "VCVARS=%VCVARS64%"
) else (
if "_%1_" == "_i686-microsoft-win32-msvc%MSVC_VER%_" (
set "VCVARS=%VCVARS32%"
@@ -40,8 +46,12 @@ if "_%1_" == "_x86_64-microsoft-win32-msvc%MSVC_VER%_" (
)
)
-call "%MSVC%\%VCVARS%"
-if errorlevel 1 goto error
+if not "_%MSVC%_" == "__" (
+ if not "_%VCVARS%_" == "__" (
+ call "%MSVC%\%VCVARS%"
+ if errorlevel 1 goto error
+ )
+)
%2 %3 %4 %5 %6 %7 %8 %9 cc config.c=cl config.cxx=cl
if errorlevel 1 goto error