Makefiles: Invert logic in MakeLauncher

Make it easier to inline into the caller.
This commit is contained in:
Stephen Kelly 2016-08-27 13:44:54 +02:00
parent 2722c4dcc5
commit e804d410cd
1 changed files with 19 additions and 20 deletions

View File

@ -1034,28 +1034,27 @@ std::string cmLocalUnixMakefileGenerator3::MakeLauncher(
// Short-circuit if there is no launcher. // Short-circuit if there is no launcher.
const char* prop = "RULE_LAUNCH_CUSTOM"; const char* prop = "RULE_LAUNCH_CUSTOM";
const char* val = this->GetRuleLauncher(target, prop); const char* val = this->GetRuleLauncher(target, prop);
if (!(val && *val)) { if (val && *val) {
return ""; // Expand rules in the empty string. It may insert the launcher and
} // perform replacements.
RuleVariables vars;
vars.RuleLauncher = prop;
vars.CMTarget = target;
std::string output;
const std::vector<std::string>& outputs = ccg.GetOutputs();
if (!outputs.empty()) {
output = this->Convert(outputs[0], relative, cmOutputConverter::SHELL);
}
vars.Output = output.c_str();
// Expand rules in the empty string. It may insert the launcher and std::string launcher;
// perform replacements. this->ExpandRuleVariables(launcher, vars);
RuleVariables vars; if (!launcher.empty()) {
vars.RuleLauncher = prop; launcher += " ";
vars.CMTarget = target; }
std::string output; return launcher;
const std::vector<std::string>& outputs = ccg.GetOutputs();
if (!outputs.empty()) {
output = this->Convert(outputs[0], relative, cmOutputConverter::SHELL);
} }
vars.Output = output.c_str(); return "";
std::string launcher;
this->ExpandRuleVariables(launcher, vars);
if (!launcher.empty()) {
launcher += " ";
}
return launcher;
} }
void cmLocalUnixMakefileGenerator3::AppendCleanCommand( void cmLocalUnixMakefileGenerator3::AppendCleanCommand(