From 06fcbc4757c7a52733a554d4050735452d49a5e7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 8 Apr 2011 10:40:57 -0400 Subject: VS10: Fix working directory of consecutive custom commands (#11938) The VS 10 msbuild tool uses a single command shell to invoke all the custom command scripts in a project. Isolate the environment and working directory of custom commands using setlocal/endlocal. The form of each command is set errlev= setlocal cd c:\work\dir if %errorlevel% neq 0 goto :cmEnd c: if %errorlevel% neq 0 goto :cmEnd command1 ... if %errorlevel% neq 0 goto :cmEnd ... commandN ... if %errorlevel% neq 0 goto :cmEnd :cmEnd endlocal & set errlev=%errorlevel% if %errlev% neq 0 goto :VCEnd so that all changes to the environment and working directory are isolated within the script and the return code is preserved. --- Source/cmLocalVisualStudioGenerator.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'Source/cmLocalVisualStudioGenerator.h') diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 22112b317d..278291e90a 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -37,13 +37,12 @@ public: const char* configName, const char* newline = "\n"); - /** Line of batch file text that skips to the end after - * a failed step in a sequence of custom commands. - */ - std::string GetCheckForErrorLine(); + /** Label to which to jump in a batch file after a failed step in a + sequence of custom commands. */ + const char* GetReportErrorLabel() const; protected: - virtual std::string CheckForErrorLine(); + virtual const char* ReportErrorLabel() const; /** Construct a custom command to make exe import lib dir. */ cmsys::auto_ptr -- cgit v1.2.1