diff options
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 3681e0e..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); @@ -1023,9 +1027,9 @@ cmLocalUnixMakefileGenerator3 } // if the command specified a working directory use it. - const char* dir = this->Makefile->GetStartOutputDirectory(); - const char* workingDir = cc.GetWorkingDirectory(); - if(workingDir) + std::string dir = this->Makefile->GetStartOutputDirectory(); + 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; @@ -1066,7 +1068,7 @@ cmLocalUnixMakefileGenerator3 // Convert the command to a relative path only if the current // working directory will be the start-output directory. bool had_slash = cmd.find("/") != cmd.npos; - if(!workingDir) + if(workingDir.empty()) { cmd = this->Convert(cmd,START_OUTPUT); } @@ -1079,7 +1081,8 @@ cmLocalUnixMakefileGenerator3 cmd = "./" + cmd; } std::string launcher = - this->MakeLauncher(cc, target, workingDir? NONE : START_OUTPUT); + this->MakeLauncher(ccg, target, + workingDir.empty()? START_OUTPUT : NONE); cmd = launcher + this->ConvertShellCommand(cmd, NONE); ccg.AppendArguments(c, cmd); @@ -1125,7 +1128,7 @@ cmLocalUnixMakefileGenerator3 } // Setup the proper working directory for the commands. - this->CreateCDCommand(commands1, dir, relative); + this->CreateCDCommand(commands1, dir.c_str(), relative); // push back the custom commands commands.insert(commands.end(), commands1.begin(), commands1.end()); @@ -1133,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"; @@ -1151,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); |