From be155668e0d78a8049ab4426c37254202f457a7f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 29 Dec 2012 19:23:02 +0000 Subject: [PATCH] [CONFIGURE] Fix MSVC configure build (problem of expansion of environment variables). svn path=/trunk/; revision=58043 --- reactos/configure.cmd | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/reactos/configure.cmd b/reactos/configure.cmd index c3fa0a6af13..b4b59087186 100755 --- a/reactos/configure.cmd +++ b/reactos/configure.cmd @@ -1,5 +1,12 @@ @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" ( echo Configuring x86 host tools for ARM cross build @@ -46,7 +53,7 @@ if defined ROS_ARCH ( 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 @@ if defined ROS_ARCH ( 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 @@ if defined ROS_ARCH ( :: Checkpoint if not defined ARCH ( - echo unknown build architecture + echo Unknown build architecture exit /b ) -- 2.17.1