[Cmake-commits] CMake branch, next, updated. v2.8.4-1405-g4981808
Brad King
brad.king at kitware.com
Mon Apr 11 12:05:03 EDT 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 4981808749aa66f014a0ac92c02c0458f19032b2 (commit)
via 234bae7a204cc23fa0d297d5ab90db7ecc54f6d4 (commit)
via b98fdd52848b45f97f8a38eaa7749186f6c8fab3 (commit)
from 8983cb1d0b9a083ef08b0e338e18d048a741668c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4981808749aa66f014a0ac92c02c0458f19032b2
commit 4981808749aa66f014a0ac92c02c0458f19032b2
Merge: 8983cb1 234bae7
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Apr 11 12:05:00 2011 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Apr 11 12:05:00 2011 -0400
Merge topic 'vs10-custom-working-directory-issue-11938' into next
234bae7 VS10: Fix exit code of custom commands with setlocal/endlocal (#11938)
b98fdd5 VS: Use setlocal/endlocal only in VS 10 custom commands
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=234bae7a204cc23fa0d297d5ab90db7ecc54f6d4
commit 234bae7a204cc23fa0d297d5ab90db7ecc54f6d4
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Apr 11 11:48:08 2011 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon Apr 11 11:54:01 2011 -0400
VS10: Fix exit code of custom commands with setlocal/endlocal (#11938)
Use the pattern
setlocal
...
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
in custom commands to preserve the %errorlevel% from inside the
setlocal/endlocal block.
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index f3936e1..4390a08 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -201,8 +201,6 @@ cmLocalVisualStudioGenerator
{
script += newline;
newline = newline_text;
- script += "set errlev=";
- script += newline;
script += "setlocal";
}
@@ -267,9 +265,15 @@ cmLocalVisualStudioGenerator
script += newline;
script += ":cmEnd";
script += newline;
- script += "endlocal & set errlev=%errorlevel%";
+ script += "endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone";
+ script += newline;
+ script += ":cmErrorLevel";
+ script += newline;
+ script += "exit /b %1";
+ script += newline;
+ script += ":cmDone";
script += newline;
- script += "if %errlev% neq 0 goto ";
+ script += "if %errorlevel% neq 0 goto ";
script += this->GetReportErrorLabel();
}
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b98fdd52848b45f97f8a38eaa7749186f6c8fab3
commit b98fdd52848b45f97f8a38eaa7749186f6c8fab3
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Apr 11 10:07:40 2011 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon Apr 11 11:53:31 2011 -0400
VS: Use setlocal/endlocal only in VS 10 custom commands
The setlocal/endlocal and errorlevel pattern added by commit 06fcbc47
(VS10: Fix working directory of consecutive custom commands, 2011-04-08)
does not work well in VS 7.1. Restore the original behavior for VS
versions that do not need the new behavior.
diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h
index 2330432..0fccdb0 100644
--- a/Source/cmLocalVisualStudio10Generator.h
+++ b/Source/cmLocalVisualStudio10Generator.h
@@ -39,6 +39,7 @@ public:
protected:
virtual const char* ReportErrorLabel() const;
+ virtual bool CustomCommandUseLocal() const { return true; }
private:
};
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index b2057b8..f3936e1 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -170,29 +170,47 @@ std::string
cmLocalVisualStudioGenerator
::ConstructScript(cmCustomCommand const& cc,
const char* configName,
- const char* newline)
+ const char* newline_text)
{
+ bool useLocal = this->CustomCommandUseLocal();
const cmCustomCommandLines& commandLines = cc.GetCommandLines();
const char* workingDirectory = cc.GetWorkingDirectory();
cmCustomCommandGenerator ccg(cc, configName, this->Makefile);
RelativeRoot relativeRoot = workingDirectory? NONE : START_OUTPUT;
+ // Avoid leading or trailing newlines.
+ const char* newline = "";
+
// Line to check for error between commands.
- std::string check_error = newline;
- check_error += "if %errorlevel% neq 0 goto :cmEnd";
+ std::string check_error = newline_text;
+ if(useLocal)
+ {
+ check_error += "if %errorlevel% neq 0 goto :cmEnd";
+ }
+ else
+ {
+ check_error += "if errorlevel 1 goto ";
+ check_error += this->GetReportErrorLabel();
+ }
// Store the script in a string.
std::string script;
// Open a local context.
- script += "set errlev=";
- script += newline;
- script += "setlocal";
+ if(useLocal)
+ {
+ script += newline;
+ newline = newline_text;
+ script += "set errlev=";
+ script += newline;
+ script += "setlocal";
+ }
if(workingDirectory)
{
// Change the working directory.
script += newline;
+ newline = newline_text;
script += "cd ";
script += this->Convert(workingDirectory, FULL, SHELL);
script += check_error;
@@ -201,6 +219,7 @@ cmLocalVisualStudioGenerator
if(workingDirectory[0] && workingDirectory[1] == ':')
{
script += newline;
+ newline = newline_text;
script += workingDirectory[0];
script += workingDirectory[1];
script += check_error;
@@ -216,6 +235,7 @@ cmLocalVisualStudioGenerator
if(extraPath)
{
script += newline;
+ newline = newline_text;
script += "set PATH=";
script += extraPath;
script += ";%PATH%";
@@ -227,6 +247,7 @@ cmLocalVisualStudioGenerator
{
// Start a new line.
script += newline;
+ newline = newline_text;
// Add this command line.
std::string cmd = ccg.GetCommand(c);
@@ -241,13 +262,16 @@ cmLocalVisualStudioGenerator
}
// Close the local context.
- script += newline;
- script += ":cmEnd";
- script += newline;
- script += "endlocal & set errlev=%errorlevel%";
- script += newline;
- script += "if %errlev% neq 0 goto ";
- script += this->GetReportErrorLabel();
+ if(useLocal)
+ {
+ script += newline;
+ script += ":cmEnd";
+ script += newline;
+ script += "endlocal & set errlev=%errorlevel%";
+ script += newline;
+ script += "if %errlev% neq 0 goto ";
+ script += this->GetReportErrorLabel();
+ }
return script;
}
diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h
index 278291e..a38bc30 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -43,6 +43,7 @@ public:
protected:
virtual const char* ReportErrorLabel() const;
+ virtual bool CustomCommandUseLocal() const { return false; }
/** Construct a custom command to make exe import lib dir. */
cmsys::auto_ptr<cmCustomCommand>
-----------------------------------------------------------------------
Summary of changes:
Source/cmLocalVisualStudio10Generator.h | 1 +
Source/cmLocalVisualStudioGenerator.cxx | 54 +++++++++++++++++++++++-------
Source/cmLocalVisualStudioGenerator.h | 1 +
3 files changed, 43 insertions(+), 13 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list