summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalUnixMakefileGenerator3.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-03-10 19:47:19 (GMT)
committerBrad King <brad.king@kitware.com>2014-03-12 14:44:01 (GMT)
commitbc993f277ebd44fabe8312a85c5682eed011336d (patch)
tree3f385f5257072c0eb18aa64badfe282eb41e3996 /Source/cmLocalUnixMakefileGenerator3.cxx
parent9a5c55441418ef79415b9a1b99c35192d2b8c1b0 (diff)
downloadCMake-bc993f277ebd44fabe8312a85c5682eed011336d.zip
CMake-bc993f277ebd44fabe8312a85c5682eed011336d.tar.gz
CMake-bc993f277ebd44fabe8312a85c5682eed011336d.tar.bz2
Generalize cmCustomCommandGenerator to more fields
Until now the cmCustomCommandGenerator was used only to compute the command lines of a custom command. Generalize it to get the comment, working directory, dependencies, and outputs of custom commands. Update use in all generators to support this.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx34
1 files changed, 18 insertions, 16 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index d3f63f5..9f12ffe 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -960,7 +960,9 @@ cmLocalUnixMakefileGenerator3
for(std::vector<cmCustomCommand>::const_iterator i = ccs.begin();
i != ccs.end(); ++i)
{
- this->AppendCustomDepend(depends, *i);
+ cmCustomCommandGenerator ccg(*i, this->ConfigurationName,
+ this->Makefile);
+ this->AppendCustomDepend(depends, ccg);
}
}
@@ -968,10 +970,10 @@ cmLocalUnixMakefileGenerator3
void
cmLocalUnixMakefileGenerator3
::AppendCustomDepend(std::vector<std::string>& depends,
- const cmCustomCommand& cc)
+ cmCustomCommandGenerator const& ccg)
{
- for(std::vector<std::string>::const_iterator d = cc.GetDepends().begin();
- d != cc.GetDepends().end(); ++d)
+ for(std::vector<std::string>::const_iterator d = ccg.GetDepends().begin();
+ d != ccg.GetDepends().end(); ++d)
{
// Lookup the real name of the dependency in case it is a CMake target.
std::string dep;
@@ -994,7 +996,9 @@ cmLocalUnixMakefileGenerator3
for(std::vector<cmCustomCommand>::const_iterator i = ccs.begin();
i != ccs.end(); ++i)
{
- this->AppendCustomCommand(commands, *i, target, true, relative);
+ cmCustomCommandGenerator ccg(*i, this->ConfigurationName,
+ this->Makefile);
+ this->AppendCustomCommand(commands, ccg, target, true, relative);
}
}
@@ -1002,7 +1006,7 @@ cmLocalUnixMakefileGenerator3
void
cmLocalUnixMakefileGenerator3
::AppendCustomCommand(std::vector<std::string>& commands,
- const cmCustomCommand& cc,
+ cmCustomCommandGenerator const& ccg,
cmTarget* target,
bool echo_comment,
cmLocalGenerator::RelativeRoot relative,
@@ -1014,8 +1018,8 @@ cmLocalUnixMakefileGenerator3
// their comments generated elsewhere.
if(echo_comment)
{
- const char* comment = cc.GetComment();
- if(comment && *comment)
+ const char* comment = ccg.GetComment();
+ if(comment && !*comment)
{
this->AppendEcho(commands, comment,
cmLocalUnixMakefileGenerator3::EchoGenerate);
@@ -1024,7 +1028,7 @@ cmLocalUnixMakefileGenerator3
// if the command specified a working directory use it.
std::string dir = this->Makefile->GetStartOutputDirectory();
- std::string workingDir = cc.GetWorkingDirectory();
+ std::string workingDir = ccg.GetWorkingDirectory();
if(!workingDir.empty())
{
dir = workingDir;
@@ -1033,8 +1037,6 @@ cmLocalUnixMakefileGenerator3
{
*content << dir;
}
- cmCustomCommandGenerator ccg(cc, this->ConfigurationName,
- this->Makefile);
// Add each command line to the set of commands.
std::vector<std::string> commands1;
@@ -1079,7 +1081,7 @@ cmLocalUnixMakefileGenerator3
cmd = "./" + cmd;
}
std::string launcher =
- this->MakeLauncher(cc, target,
+ this->MakeLauncher(ccg, target,
workingDir.empty()? START_OUTPUT : NONE);
cmd = launcher + this->ConvertShellCommand(cmd, NONE);
@@ -1134,9 +1136,9 @@ cmLocalUnixMakefileGenerator3
//----------------------------------------------------------------------------
std::string
-cmLocalUnixMakefileGenerator3::MakeLauncher(const cmCustomCommand& cc,
- cmTarget* target,
- RelativeRoot relative)
+cmLocalUnixMakefileGenerator3::MakeLauncher(
+ cmCustomCommandGenerator const& ccg,
+ cmTarget* target, RelativeRoot relative)
{
// Short-circuit if there is no launcher.
const char* prop = "RULE_LAUNCH_CUSTOM";
@@ -1152,7 +1154,7 @@ cmLocalUnixMakefileGenerator3::MakeLauncher(const cmCustomCommand& cc,
vars.RuleLauncher = prop;
vars.CMTarget = target;
std::string output;
- const std::vector<std::string>& outputs = cc.GetOutputs();
+ const std::vector<std::string>& outputs = ccg.GetOutputs();
if(!outputs.empty())
{
output = this->Convert(outputs[0], relative, SHELL);