From e804d410cd4e391cd81ff3d8981cfba1fae28742 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 27 Aug 2016 13:44:54 +0200 Subject: [PATCH] Makefiles: Invert logic in MakeLauncher Make it easier to inline into the caller. --- Source/cmLocalUnixMakefileGenerator3.cxx | 39 ++++++++++++------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index e1488876d..47b891f30 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1034,28 +1034,27 @@ std::string cmLocalUnixMakefileGenerator3::MakeLauncher( // Short-circuit if there is no launcher. const char* prop = "RULE_LAUNCH_CUSTOM"; const char* val = this->GetRuleLauncher(target, prop); - if (!(val && *val)) { - return ""; - } + if (val && *val) { + // 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& 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 - // perform replacements. - RuleVariables vars; - vars.RuleLauncher = prop; - vars.CMTarget = target; - std::string output; - const std::vector& outputs = ccg.GetOutputs(); - if (!outputs.empty()) { - output = this->Convert(outputs[0], relative, cmOutputConverter::SHELL); + std::string launcher; + this->ExpandRuleVariables(launcher, vars); + if (!launcher.empty()) { + launcher += " "; + } + return launcher; } - vars.Output = output.c_str(); - - std::string launcher; - this->ExpandRuleVariables(launcher, vars); - if (!launcher.empty()) { - launcher += " "; - } - return launcher; + return ""; } void cmLocalUnixMakefileGenerator3::AppendCleanCommand(