mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
BUG: Centralized generation of command line arguments in escaped form. This addresses bug#3786 for several platforms.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user