@echo off\r
\r
+:: This is needed so as to avoid static expansion of environment variables\r
+:: inside if (...) conditionals.\r
+:: See http://stackoverflow.com/questions/305605/weird-scope-issue-in-bat-file\r
+:: for more explanation.\r
+:: Precisely needed for configuring Visual Studio Environment.\r
+setlocal enabledelayedexpansion\r
+\r
:: Special case %1 = arm_hosttools %2 = vcvarsall.bat %3 = %CMAKE_GENERATOR%\r
if /I "%1" == "arm_hosttools" (\r
echo Configuring x86 host tools for ARM cross build\r
set USE_WDK_HEADERS=0\r
\r
) else if defined VCINSTALLDIR (\r
- :: VS command prompt does not put this in enviroment vars\r
+ :: VS command prompt does not put this in environment vars\r
cl 2>&1 | find "x86" > NUL && set ARCH=i386\r
cl 2>&1 | find "x64" > NUL && set ARCH=amd64\r
cl 2>&1 | find "ARM" > NUL && set ARCH=arm\r
exit /b\r
)\r
\r
- echo Detected Visual Studio Environment %BUILD_ENVIRONMENT%-%ARCH%\r
+ echo Detected Visual Studio Environment !BUILD_ENVIRONMENT!-!ARCH!\r
if /I "%1" == "VSSolution" (\r
- if "%BUILD_ENVIRONMENT%" == "VS8" (\r
- if "%ARCH%" == "amd64" (\r
+ if "!BUILD_ENVIRONMENT!" == "VS8" (\r
+ if "!ARCH!" == "amd64" (\r
set CMAKE_GENERATOR="Visual Studio 8 2005 Win64"\r
) else (\r
set CMAKE_GENERATOR="Visual Studio 8 2005"\r
)\r
- ) else if "%BUILD_ENVIRONMENT%" == "VS9" (\r
- if "%ARCH%" == "amd64" (\r
+ ) else if "!BUILD_ENVIRONMENT!" == "VS9" (\r
+ if "!ARCH!" == "amd64" (\r
set CMAKE_GENERATOR="Visual Studio 9 2008 Win64"\r
) else (\r
set CMAKE_GENERATOR="Visual Studio 9 2008"\r
)\r
- ) else if "%BUILD_ENVIRONMENT%" == "VS10" (\r
- if "%ARCH%" == "amd64" (\r
+ ) else if "!BUILD_ENVIRONMENT!" == "VS10" (\r
+ if "!ARCH!" == "amd64" (\r
set CMAKE_GENERATOR="Visual Studio 10 Win64"\r
) else (\r
set CMAKE_GENERATOR="Visual Studio 10"\r
)\r
- ) else if "%BUILD_ENVIRONMENT%" == "VS11" (\r
- if "%ARCH%" == "amd64" (\r
+ ) else if "!BUILD_ENVIRONMENT!" == "VS11" (\r
+ if "!ARCH!" == "amd64" (\r
set CMAKE_GENERATOR="Visual Studio 11 Win64"\r
- ) else if "%ARCH%" == "arm" (\r
+ ) else if "!ARCH!" == "arm" (\r
set CMAKE_GENERATOR="Visual Studio 11 ARM"\r
) else (\r
set CMAKE_GENERATOR="Visual Studio 11"\r
\r
:: Checkpoint\r
if not defined ARCH (\r
- echo unknown build architecture\r
+ echo Unknown build architecture\r
exit /b\r
)\r
\r