Ninja: Use cmSystemTools::ExpandListArgument to split compile/link commands
This commit is contained in:
parent
d2731a376c
commit
80ff2102a4
|
@ -219,6 +219,7 @@ std::vector<std::string>
|
||||||
cmNinjaNormalTargetGenerator
|
cmNinjaNormalTargetGenerator
|
||||||
::ComputeLinkCmd()
|
::ComputeLinkCmd()
|
||||||
{
|
{
|
||||||
|
std::vector<std::string> linkCmds;
|
||||||
cmTarget::TargetType targetType = this->GetTarget()->GetType();
|
cmTarget::TargetType targetType = this->GetTarget()->GetType();
|
||||||
switch (targetType) {
|
switch (targetType) {
|
||||||
case cmTarget::STATIC_LIBRARY: {
|
case cmTarget::STATIC_LIBRARY: {
|
||||||
|
@ -230,7 +231,8 @@ cmNinjaNormalTargetGenerator
|
||||||
if (const char *linkCmd =
|
if (const char *linkCmd =
|
||||||
this->GetMakefile()->GetDefinition(linkCmdVar.c_str()))
|
this->GetMakefile()->GetDefinition(linkCmdVar.c_str()))
|
||||||
{
|
{
|
||||||
return std::vector<std::string>(1, linkCmd);
|
cmSystemTools::ExpandListArgument(linkCmd, linkCmds);
|
||||||
|
return linkCmds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +251,7 @@ cmNinjaNormalTargetGenerator
|
||||||
linkCmdVar += "_ARCHIVE_CREATE";
|
linkCmdVar += "_ARCHIVE_CREATE";
|
||||||
const char *linkCmd =
|
const char *linkCmd =
|
||||||
this->GetMakefile()->GetRequiredDefinition(linkCmdVar.c_str());
|
this->GetMakefile()->GetRequiredDefinition(linkCmdVar.c_str());
|
||||||
linkCmds.push_back(linkCmd);
|
cmSystemTools::ExpandListArgument(linkCmd, linkCmds);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::string linkCmdVar = "CMAKE_";
|
std::string linkCmdVar = "CMAKE_";
|
||||||
|
@ -257,7 +259,7 @@ cmNinjaNormalTargetGenerator
|
||||||
linkCmdVar += "_ARCHIVE_FINISH";
|
linkCmdVar += "_ARCHIVE_FINISH";
|
||||||
const char *linkCmd =
|
const char *linkCmd =
|
||||||
this->GetMakefile()->GetRequiredDefinition(linkCmdVar.c_str());
|
this->GetMakefile()->GetRequiredDefinition(linkCmdVar.c_str());
|
||||||
linkCmds.push_back(linkCmd);
|
cmSystemTools::ExpandListArgument(linkCmd, linkCmds);
|
||||||
}
|
}
|
||||||
return linkCmds;
|
return linkCmds;
|
||||||
}
|
}
|
||||||
|
@ -281,7 +283,8 @@ cmNinjaNormalTargetGenerator
|
||||||
}
|
}
|
||||||
const char *linkCmd =
|
const char *linkCmd =
|
||||||
this->GetMakefile()->GetRequiredDefinition(linkCmdVar.c_str());
|
this->GetMakefile()->GetRequiredDefinition(linkCmdVar.c_str());
|
||||||
return std::vector<std::string>(1, linkCmd);
|
cmSystemTools::ExpandListArgument(linkCmd, linkCmds);
|
||||||
|
return linkCmds;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
assert(0 && "Unexpected target type");
|
assert(0 && "Unexpected target type");
|
||||||
|
|
|
@ -334,8 +334,15 @@ cmNinjaTargetGenerator
|
||||||
compileCmdVar += "_COMPILE_OBJECT";
|
compileCmdVar += "_COMPILE_OBJECT";
|
||||||
std::string compileCmd =
|
std::string compileCmd =
|
||||||
this->GetMakefile()->GetRequiredDefinition(compileCmdVar.c_str());
|
this->GetMakefile()->GetRequiredDefinition(compileCmdVar.c_str());
|
||||||
|
std::vector<std::string> compileCmds;
|
||||||
|
cmSystemTools::ExpandListArgument(compileCmd, compileCmds);
|
||||||
|
|
||||||
this->GetLocalGenerator()->ExpandRuleVariables(compileCmd, vars);
|
for (std::vector<std::string>::iterator i = compileCmds.begin();
|
||||||
|
i != compileCmds.end(); ++i)
|
||||||
|
this->GetLocalGenerator()->ExpandRuleVariables(*i, vars);
|
||||||
|
|
||||||
|
std::string cmdLine =
|
||||||
|
this->GetLocalGenerator()->BuildCommandLine(compileCmds);
|
||||||
|
|
||||||
// Write the rule for compiling file of the given language.
|
// Write the rule for compiling file of the given language.
|
||||||
std::ostringstream comment;
|
std::ostringstream comment;
|
||||||
|
@ -343,7 +350,7 @@ cmNinjaTargetGenerator
|
||||||
std::ostringstream description;
|
std::ostringstream description;
|
||||||
description << "Building " << language << " object $out";
|
description << "Building " << language << " object $out";
|
||||||
this->GetGlobalGenerator()->AddRule(this->LanguageCompilerRule(language),
|
this->GetGlobalGenerator()->AddRule(this->LanguageCompilerRule(language),
|
||||||
compileCmd,
|
cmdLine,
|
||||||
description.str(),
|
description.str(),
|
||||||
comment.str(),
|
comment.str(),
|
||||||
depfile);
|
depfile);
|
||||||
|
|
Loading…
Reference in New Issue