Ninja: Honor CMAKE_NINJA_FORCE_RESPONSE_FILE for compile rules

This commit is contained in:
Dmitry Ivanov 2016-04-06 12:55:15 +02:00 committed by Brad King
parent f9644a2d1b
commit 7731e44f87

View File

@ -341,11 +341,25 @@ cmNinjaTargetGenerator
cmMakefile* mf = this->GetMakefile(); cmMakefile* mf = this->GetMakefile();
std::string flags = "$FLAGS";
std::string rspfile;
std::string rspcontent;
std::string responseFlag;
if (this->ForceResponseFile())
{
rspfile = "$RSP_FILE";
responseFlag = "@" + rspfile;
rspcontent = " $DEFINES $INCLUDES $FLAGS";
flags = responseFlag;
vars.Defines = "";
vars.Includes = "";
}
// Tell ninja dependency format so all deps can be loaded into a database // Tell ninja dependency format so all deps can be loaded into a database
std::string deptype; std::string deptype;
std::string depfile; std::string depfile;
std::string cldeps; std::string cldeps;
std::string flags = "$FLAGS";
if (this->NeedDepTypeMSVC(lang)) if (this->NeedDepTypeMSVC(lang))
{ {
deptype = "msvc"; deptype = "msvc";
@ -460,8 +474,8 @@ cmNinjaTargetGenerator
comment.str(), comment.str(),
depfile, depfile,
deptype, deptype,
/*rspfile*/ "", rspfile,
/*rspcontent*/ "", rspcontent,
/*restat*/ "", /*restat*/ "",
/*generator*/ false); /*generator*/ false);
} }
@ -641,6 +655,9 @@ cmNinjaTargetGenerator
this->SetMsvcTargetPdbVariable(vars); this->SetMsvcTargetPdbVariable(vars);
int const commandLineLengthLimit = this->ForceResponseFile() ? -1 : 0;
std::string const rspfile = objectFileName + ".rsp";
this->GetGlobalGenerator()->WriteBuild(this->GetBuildFileStream(), this->GetGlobalGenerator()->WriteBuild(this->GetBuildFileStream(),
comment, comment,
rule, rule,
@ -648,7 +665,10 @@ cmNinjaTargetGenerator
explicitDeps, explicitDeps,
implicitDeps, implicitDeps,
orderOnlyDeps, orderOnlyDeps,
vars); vars,
rspfile,
commandLineLengthLimit);
if(const char* objectOutputs = source->GetProperty("OBJECT_OUTPUTS")) { if(const char* objectOutputs = source->GetProperty("OBJECT_OUTPUTS")) {
std::vector<std::string> outputList; std::vector<std::string> outputList;