From 24c9106b7b2c3729985b89b06a2732ee3f555022 Mon Sep 17 00:00:00 2001 From: Dmitry Ivanov Date: Wed, 6 Apr 2016 12:55:15 +0200 Subject: cmNinjaTargetGenerator: Factor out helper for forced response file check --- Source/cmNinjaNormalTargetGenerator.cxx | 4 +--- Source/cmNinjaTargetGenerator.cxx | 7 +++++++ Source/cmNinjaTargetGenerator.h | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index c34df3c..54cacef 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -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())); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 5ff4fdb..87f0e3a 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -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); +} diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index e3ec423..371bc3c 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -152,6 +152,8 @@ protected: cmGeneratorTarget* target, cmNinjaVars& vars); + bool ForceResponseFile(); + private: cmLocalNinjaGenerator* LocalGenerator; /// List of object files for this target. -- cgit v0.12