|
|
@@ -14,6 +14,7 @@
|
|
|
#include "cmMakefile.h"
|
|
|
#include "cmSourceFile.h"
|
|
|
#include "cmSystemTools.h"
|
|
|
+#include "cmCustomCommandGenerator.h"
|
|
|
#include "windows.h"
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
@@ -52,7 +53,7 @@ cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target,
|
|
|
std::vector<std::string> no_depends;
|
|
|
cmCustomCommandLines commands;
|
|
|
commands.push_back(command);
|
|
|
- pcc.reset(new cmCustomCommand(no_output, no_depends, commands, 0, 0));
|
|
|
+ pcc.reset(new cmCustomCommand(0, no_output, no_depends, commands, 0, 0));
|
|
|
pcc->SetEscapeOldStyle(false);
|
|
|
pcc->SetEscapeAllowMakeVars(true);
|
|
|
return pcc;
|
|
|
@@ -151,13 +152,15 @@ void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements
|
|
|
//----------------------------------------------------------------------------
|
|
|
std::string
|
|
|
cmLocalVisualStudioGenerator
|
|
|
-::ConstructScript(const cmCustomCommandLines& commandLines,
|
|
|
- const char* workingDirectory,
|
|
|
+::ConstructScript(cmCustomCommand const& cc,
|
|
|
const char* configName,
|
|
|
- bool escapeOldStyle,
|
|
|
- bool escapeAllowMakeVars,
|
|
|
const char* newline_text)
|
|
|
{
|
|
|
+ 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 = "";
|
|
|
|
|
|
@@ -196,40 +199,16 @@ cmLocalVisualStudioGenerator
|
|
|
}
|
|
|
}
|
|
|
// Write each command on a single line.
|
|
|
- for(cmCustomCommandLines::const_iterator cl = commandLines.begin();
|
|
|
- cl != commandLines.end(); ++cl)
|
|
|
+ for(unsigned int c = 0; c < ccg.GetNumberOfCommands(); ++c)
|
|
|
{
|
|
|
// Start a new line.
|
|
|
script += newline;
|
|
|
newline = newline_text;
|
|
|
|
|
|
- // Start with the command name.
|
|
|
- const cmCustomCommandLine& commandLine = *cl;
|
|
|
- std::string commandName = this->GetRealLocation(commandLine[0].c_str(),
|
|
|
- configName);
|
|
|
- if(!workingDirectory)
|
|
|
- {
|
|
|
- script += this->Convert(commandName.c_str(),START_OUTPUT,SHELL);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- script += this->Convert(commandName.c_str(),NONE,SHELL);
|
|
|
- }
|
|
|
-
|
|
|
- // Add the arguments.
|
|
|
- for(unsigned int j=1;j < commandLine.size(); ++j)
|
|
|
- {
|
|
|
- script += " ";
|
|
|
- if(escapeOldStyle)
|
|
|
- {
|
|
|
- script += this->EscapeForShellOldStyle(commandLine[j].c_str());
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- script += this->EscapeForShell(commandLine[j].c_str(),
|
|
|
- escapeAllowMakeVars);
|
|
|
- }
|
|
|
- }
|
|
|
+ // Add this command line.
|
|
|
+ std::string cmd = ccg.GetCommand(c);
|
|
|
+ script += this->Convert(cmd.c_str(), relativeRoot, SHELL);
|
|
|
+ ccg.AppendArguments(c, script);
|
|
|
|
|
|
// After each custom command, check for an error result.
|
|
|
// If there was an error, jump to the VCReportError label,
|