summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalVisualStudioGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-12-21 19:03:02 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2010-12-21 19:03:02 (GMT)
commit533f5a20372829aa41a71ed4698cac2a50820a7e (patch)
tree076562bbb762e4fc61c0bce10a13b02528e0fcbe /Source/cmLocalVisualStudioGenerator.cxx
parentea38628366634189502b57c53d866bc436eb7c7f (diff)
parent53ea8b32045ce4c8045b904407e7e57d8d9fd4ab (diff)
downloadCMake-533f5a20372829aa41a71ed4698cac2a50820a7e.zip
CMake-533f5a20372829aa41a71ed4698cac2a50820a7e.tar.gz
CMake-533f5a20372829aa41a71ed4698cac2a50820a7e.tar.bz2
Merge topic 'custom-command-refactor'
53ea8b3 Merge branch 'imported-target-dependencies' into custom-command-refactor 1a29cca Remove cmLocalGenerator::GetRealLocation 542b517 Factor out common custom command generator 6fe5b3d Simplify VS generator ConstructScript interface
Diffstat (limited to 'Source/cmLocalVisualStudioGenerator.cxx')
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx45
1 files changed, 12 insertions, 33 deletions
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 8eddc43..9a8cbc7 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -14,6 +14,7 @@
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmSystemTools.h"
+#include "cmCustomCommandGenerator.h"
#include "windows.h"
//----------------------------------------------------------------------------
@@ -163,13 +164,15 @@ std::string cmLocalVisualStudioGenerator::GetCheckForErrorLine()
//----------------------------------------------------------------------------
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 = "";
@@ -208,40 +211,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,