Commit 3e125c0c authored by Brad King's avatar Brad King
Browse files

Ninja,Makefile: Drop extra space after RULE_LAUNCH_CUSTOM value



The Ninja and Makefile generators were adding a space to the value both
before and after expanding rule variables.  Only the latter is needed.

While at it, revise some outdated comments since the rule variable
expansion is no longer responsible for inserting the launcher.
Suggested-by: Máté Pék's avatarMate Pek <mate.pek@gmail.com>
Fixes: #18340
parent 344eb9c8
...@@ -564,8 +564,7 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher( ...@@ -564,8 +564,7 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher(
return std::string(); return std::string();
} }
// Expand rules in the empty string. It may insert the launcher and // Expand rule variables referenced in the given launcher command.
// perform replacements.
cmRulePlaceholderExpander::RuleVariables vars; cmRulePlaceholderExpander::RuleVariables vars;
std::string output; std::string output;
...@@ -580,12 +579,10 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher( ...@@ -580,12 +579,10 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher(
} }
vars.Output = output.c_str(); vars.Output = output.c_str();
std::string launcher = property_value;
launcher += " ";
std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
this->CreateRulePlaceholderExpander()); this->CreateRulePlaceholderExpander());
std::string launcher = property_value;
rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars); rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars);
if (!launcher.empty()) { if (!launcher.empty()) {
launcher += " "; launcher += " ";
......
...@@ -967,8 +967,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( ...@@ -967,8 +967,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
// Short-circuit if there is no launcher. // Short-circuit if there is no launcher.
const char* val = this->GetRuleLauncher(target, "RULE_LAUNCH_CUSTOM"); const char* val = this->GetRuleLauncher(target, "RULE_LAUNCH_CUSTOM");
if (val && *val) { if (val && *val) {
// Expand rules in the empty string. It may insert the launcher and // Expand rule variables referenced in the given launcher command.
// perform replacements.
cmRulePlaceholderExpander::RuleVariables vars; cmRulePlaceholderExpander::RuleVariables vars;
vars.CMTargetName = target->GetName().c_str(); vars.CMTargetName = target->GetName().c_str();
vars.CMTargetType = cmState::GetTargetTypeName(target->GetType()); vars.CMTargetType = cmState::GetTargetTypeName(target->GetType());
...@@ -986,7 +985,6 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( ...@@ -986,7 +985,6 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
vars.Output = output.c_str(); vars.Output = output.c_str();
launcher = val; launcher = val;
launcher += " ";
rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars); rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars);
if (!launcher.empty()) { if (!launcher.empty()) {
launcher += " "; launcher += " ";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment