cmNinjaTargetGenerator: Factor out helper for forced response file check

This commit is contained in:
Dmitry Ivanov 2016-04-06 12:55:15 +02:00 committed by Brad King
parent 82c405c473
commit 24c9106b7b
3 changed files with 10 additions and 3 deletions

View File

@ -698,9 +698,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
cmGlobalNinjaGenerator& globalGen = *this->GetGlobalGenerator();
int commandLineLengthLimit = 1;
const char* forceRspFile = "CMAKE_NINJA_FORCE_RESPONSE_FILE";
if (!mf->IsDefinitionSet(forceRspFile) &&
cmSystemTools::GetEnv(forceRspFile) == 0)
if (!this->ForceResponseFile())
{
commandLineLengthLimit = calculateCommandLineLengthLimit(
globalGen.GetRuleCmdLength(this->LanguageLinkerRule()));

View File

@ -795,3 +795,10 @@ void cmNinjaTargetGenerator::addPoolNinjaVariable(
vars["pool"] = pool;
}
}
bool cmNinjaTargetGenerator::ForceResponseFile()
{
static std::string const forceRspFile = "CMAKE_NINJA_FORCE_RESPONSE_FILE";
return (this->GetMakefile()->IsDefinitionSet(forceRspFile) ||
cmSystemTools::GetEnv(forceRspFile) != 0);
}

View File

@ -152,6 +152,8 @@ protected:
cmGeneratorTarget* target,
cmNinjaVars& vars);
bool ForceResponseFile();
private:
cmLocalNinjaGenerator* LocalGenerator;
/// List of object files for this target.