Commit 15c52e98 authored by Brad King's avatar Brad King
Browse files

ENH: Add rule substitutions useful for launchers

This defines make rule substitutions <LANGUAGE>, <TARGET_NAME>,
<TARGET_TYPE>, and <OUTPUT>.  They will be useful for RULE_LAUNCH_*
property values.
parent b604b98c
......@@ -972,6 +972,31 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
return replaceValues.LinkLibraries;
}
}
if(replaceValues.Language)
{
if(variable == "LANGUAGE")
{
return replaceValues.Language;
}
}
if(replaceValues.CMTarget)
{
if(variable == "TARGET_NAME")
{
return replaceValues.CMTarget->GetName();
}
if(variable == "TARGET_TYPE")
{
return cmTarget::TargetTypeNames[replaceValues.CMTarget->GetType()];
}
}
if(replaceValues.Output)
{
if(variable == "OUTPUT")
{
return replaceValues.Output;
}
}
if(variable == "CMAKE_COMMAND")
{
const char* cmcommand =
......
......@@ -214,6 +214,7 @@ public:
const char* Source;
const char* AssemblySource;
const char* PreprocessedSource;
const char* Output;
const char* Object;
const char* ObjectDir;
const char* Flags;
......
......@@ -1114,6 +1114,13 @@ cmLocalUnixMakefileGenerator3::MakeLauncher(const cmCustomCommand& cc,
RuleVariables vars;
vars.RuleLauncher = prop;
vars.CMTarget = target;
std::string output;
const std::vector<std::string>& outputs = cc.GetOutputs();
if(!outputs.empty())
{
output = this->Convert(outputs[0].c_str(), relative, SHELL);
}
vars.Output = output.c_str();
std::string launcher;
this->ExpandRuleVariables(launcher, vars);
......
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