Author: hbelusca
Date: Sat Dec 29 19:23:02 2012
New Revision: 58043
URL:
http://svn.reactos.org/svn/reactos?rev=58043&view=rev
Log:
[CONFIGURE]
Fix MSVC configure build (problem of expansion of environment variables).
Modified:
trunk/reactos/configure.cmd
Modified: trunk/reactos/configure.cmd
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/configure.cmd?rev=58043&am…
==============================================================================
--- trunk/reactos/configure.cmd [iso-8859-1] (original)
+++ trunk/reactos/configure.cmd [iso-8859-1] Sat Dec 29 19:23:02 2012
@@ -1,4 +1,11 @@
@echo off
+
+:: This is needed so as to avoid static expansion of environment variables
+:: inside if (...) conditionals.
+:: See
http://stackoverflow.com/questions/305605/weird-scope-issue-in-bat-file
+:: for more explanation.
+:: Precisely needed for configuring Visual Studio Environment.
+setlocal enabledelayedexpansion
:: Special case %1 = arm_hosttools %2 = vcvarsall.bat %3 = %CMAKE_GENERATOR%
if /I "%1" == "arm_hosttools" (
@@ -46,7 +53,7 @@
set USE_WDK_HEADERS=0
) else if defined VCINSTALLDIR (
- :: VS command prompt does not put this in enviroment vars
+ :: VS command prompt does not put this in environment vars
cl 2>&1 | find "x86" > NUL && set ARCH=i386
cl 2>&1 | find "x64" > NUL && set ARCH=amd64
cl 2>&1 | find "ARM" > NUL && set ARCH=arm
@@ -59,30 +66,30 @@
exit /b
)
- echo Detected Visual Studio Environment %BUILD_ENVIRONMENT%-%ARCH%
+ echo Detected Visual Studio Environment !BUILD_ENVIRONMENT!-!ARCH!
if /I "%1" == "VSSolution" (
- if "%BUILD_ENVIRONMENT%" == "VS8" (
- if "%ARCH%" == "amd64" (
+ if "!BUILD_ENVIRONMENT!" == "VS8" (
+ if "!ARCH!" == "amd64" (
set CMAKE_GENERATOR="Visual Studio 8 2005 Win64"
) else (
set CMAKE_GENERATOR="Visual Studio 8 2005"
)
- ) else if "%BUILD_ENVIRONMENT%" == "VS9" (
- if "%ARCH%" == "amd64" (
+ ) else if "!BUILD_ENVIRONMENT!" == "VS9" (
+ if "!ARCH!" == "amd64" (
set CMAKE_GENERATOR="Visual Studio 9 2008 Win64"
) else (
set CMAKE_GENERATOR="Visual Studio 9 2008"
)
- ) else if "%BUILD_ENVIRONMENT%" == "VS10" (
- if "%ARCH%" == "amd64" (
+ ) else if "!BUILD_ENVIRONMENT!" == "VS10" (
+ if "!ARCH!" == "amd64" (
set CMAKE_GENERATOR="Visual Studio 10 Win64"
) else (
set CMAKE_GENERATOR="Visual Studio 10"
)
- ) else if "%BUILD_ENVIRONMENT%" == "VS11" (
- if "%ARCH%" == "amd64" (
+ ) else if "!BUILD_ENVIRONMENT!" == "VS11" (
+ if "!ARCH!" == "amd64" (
set CMAKE_GENERATOR="Visual Studio 11 Win64"
- ) else if "%ARCH%" == "arm" (
+ ) else if "!ARCH!" == "arm" (
set CMAKE_GENERATOR="Visual Studio 11 ARM"
) else (
set CMAKE_GENERATOR="Visual Studio 11"
@@ -111,7 +118,7 @@
:: Checkpoint
if not defined ARCH (
- echo unknown build architecture
+ echo Unknown build architecture
exit /b
)