summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalVisualStudioGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-09-21 19:14:06 (GMT)
committerBrad King <brad.king@kitware.com>2006-09-21 19:14:06 (GMT)
commit2459ceb076d7788f7512ef4a2f68e81c43bc271d (patch)
treeb198c9b7a49aed110b2a706f82426e84690dc582 /Source/cmLocalVisualStudioGenerator.cxx
parent0952a96485cad05f68724f0a703758dceb60add9 (diff)
downloadCMake-2459ceb076d7788f7512ef4a2f68e81c43bc271d.zip
CMake-2459ceb076d7788f7512ef4a2f68e81c43bc271d.tar.gz
CMake-2459ceb076d7788f7512ef4a2f68e81c43bc271d.tar.bz2
BUG: Centralized generation of command line arguments in escaped form. This addresses bug#3786 for several platforms.
Diffstat (limited to 'Source/cmLocalVisualStudioGenerator.cxx')
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx51
1 files changed, 51 insertions, 0 deletions
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index f2da64e..f874987 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -23,6 +23,7 @@
//----------------------------------------------------------------------------
cmLocalVisualStudioGenerator::cmLocalVisualStudioGenerator()
{
+ this->WindowsShell = true;
}
//----------------------------------------------------------------------------
@@ -103,3 +104,53 @@ void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements
}
}
}
+
+//----------------------------------------------------------------------------
+std::string
+cmLocalVisualStudioGenerator
+::ConstructScript(const cmCustomCommandLines& commandLines,
+ const char* workingDirectory,
+ const char* newline)
+{
+ // Store the script in a string.
+ std::string script;
+ if(workingDirectory)
+ {
+ 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.
+ if(this->Makefile->GetDefinition("MSVC_IDE"))
+ {
+ const char* extraPath =
+ this->Makefile->GetDefinition("CMAKE_MSVCIDE_RUN_PATH");
+ if(extraPath)
+ {
+ 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 with the command name.
+ const cmCustomCommandLine& commandLine = *cl;
+ script += this->Convert(commandLine[0].c_str(),START_OUTPUT,SHELL);
+
+ // Add the arguments.
+ for(unsigned int j=1;j < commandLine.size(); ++j)
+ {
+ script += " ";
+ script += this->EscapeForShell(commandLine[j].c_str());
+ }
+
+ // End the line.
+ script += newline;
+ }
+ return script;
+}