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
1 changed files with 24 additions and 4 deletions

View File

@ -341,11 +341,25 @@ cmNinjaTargetGenerator
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
std::string deptype;
std::string depfile;
std::string cldeps;
std::string flags = "$FLAGS";
if (this->NeedDepTypeMSVC(lang))
{
deptype = "msvc";
@ -460,8 +474,8 @@ cmNinjaTargetGenerator
comment.str(),
depfile,
deptype,
/*rspfile*/ "",
/*rspcontent*/ "",
rspfile,
rspcontent,
/*restat*/ "",
/*generator*/ false);
}
@ -641,6 +655,9 @@ cmNinjaTargetGenerator
this->SetMsvcTargetPdbVariable(vars);
int const commandLineLengthLimit = this->ForceResponseFile() ? -1 : 0;
std::string const rspfile = objectFileName + ".rsp";
this->GetGlobalGenerator()->WriteBuild(this->GetBuildFileStream(),
comment,
rule,
@ -648,7 +665,10 @@ cmNinjaTargetGenerator
explicitDeps,
implicitDeps,
orderOnlyDeps,
vars);
vars,
rspfile,
commandLineLengthLimit);
if(const char* objectOutputs = source->GetProperty("OBJECT_OUTPUTS")) {
std::vector<std::string> outputList;