summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-10-25 16:27:17 (GMT)
committerBrad King <brad.king@kitware.com>2006-10-25 16:27:17 (GMT)
commite23b82c2cfee4437bc191f867348076f61f81dc3 (patch)
tree3f5c9db81c755a252e4ccf828188b755937d47b4
parent9b8f479e010cdaf46197fe45f89d97f0f4a8f35f (diff)
downloadCMake-e23b82c2cfee4437bc191f867348076f61f81dc3.zip
CMake-e23b82c2cfee4437bc191f867348076f61f81dc3.tar.gz
CMake-e23b82c2cfee4437bc191f867348076f61f81dc3.tar.bz2
BUG: Avoid leading and trailing newlines in custom command scripts because some VS6 versions do not like the trailing backslash this produces. This addresses bug#3977.
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx18
1 files changed, 12 insertions, 6 deletions
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index c342e28..25efbbb 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -113,15 +113,19 @@ cmLocalVisualStudioGenerator
const char* workingDirectory,
bool escapeOldStyle,
bool escapeAllowMakeVars,
- const char* newline)
+ const char* newline_text)
{
+ // Avoid leading or trailing newlines.
+ const char* newline = "";
+
// Store the script in a string.
std::string script;
if(workingDirectory)
{
+ script += newline;
+ newline = newline_text;
script += "cd ";
script += this->Convert(workingDirectory, START_OUTPUT, SHELL);
- script += newline;
}
// for visual studio IDE add extra stuff to the PATH
// if CMAKE_MSVCIDE_RUN_PATH is set.
@@ -131,16 +135,21 @@ cmLocalVisualStudioGenerator
this->Makefile->GetDefinition("CMAKE_MSVCIDE_RUN_PATH");
if(extraPath)
{
+ script += newline;
+ newline = newline_text;
script += "set PATH=";
script += extraPath;
script += ";%PATH%";
- script += newline;
}
}
// Write each command on a single line.
for(cmCustomCommandLines::const_iterator cl = commandLines.begin();
cl != commandLines.end(); ++cl)
{
+ // Start a new line.
+ script += newline;
+ newline = newline_text;
+
// Start with the command name.
const cmCustomCommandLine& commandLine = *cl;
script += this->Convert(commandLine[0].c_str(),START_OUTPUT,SHELL);
@@ -159,9 +168,6 @@ cmLocalVisualStudioGenerator
escapeAllowMakeVars);
}
}
-
- // End the line.
- script += newline;
}
return script;
}