summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-11-02 21:31:27 (GMT)
committerBrad King <brad.king@kitware.com>2015-11-02 21:37:59 (GMT)
commita3c5ca960bdf7c136fc64e3bb6d6619ca30623d2 (patch)
tree279d1d43a7e44b7053159873d2e6dcd2037fb78d /Source/cmGlobalNinjaGenerator.cxx
parented67f4052264003133b19edde2c85791d501e001 (diff)
downloadCMake-a3c5ca960bdf7c136fc64e3bb6d6619ca30623d2.zip
CMake-a3c5ca960bdf7c136fc64e3bb6d6619ca30623d2.tar.gz
CMake-a3c5ca960bdf7c136fc64e3bb6d6619ca30623d2.tar.bz2
cmGlobalNinjaGenerator: Save 'ninja' version very early
Keep it in a member variable for convenient reference. Store the value as soon as it is known.
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx25
1 files changed, 11 insertions, 14 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 6e7c43a..a8a307c 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -548,11 +548,11 @@ void cmGlobalNinjaGenerator::Generate()
{
// Check minimum Ninja version.
if (cmSystemTools::VersionCompare(cmSystemTools::OP_LESS,
- CurrentNinjaVersion().c_str(),
+ this->NinjaVersion.c_str(),
RequiredNinjaVersion().c_str()))
{
std::ostringstream msg;
- msg << "The detected version of Ninja (" << this->CurrentNinjaVersion();
+ msg << "The detected version of Ninja (" << this->NinjaVersion;
msg << ") is less than the version of Ninja required by CMake (";
msg << this->RequiredNinjaVersion() << ").";
this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, msg.str());
@@ -591,6 +591,14 @@ void cmGlobalNinjaGenerator::FindMakeProgram(cmMakefile* mf)
if (const char* ninjaCommand = mf->GetDefinition("CMAKE_MAKE_PROGRAM"))
{
this->NinjaCommand = ninjaCommand;
+ std::vector<std::string> command;
+ command.push_back(this->NinjaCommand);
+ command.push_back("--version");
+ std::string version;
+ cmSystemTools::RunSingleCommand(command,
+ &version, 0, 0, 0,
+ cmSystemTools::OUTPUT_NONE);
+ this->NinjaVersion = cmSystemTools::TrimWhitespace(version);
}
}
@@ -1275,21 +1283,10 @@ std::string cmGlobalNinjaGenerator::ninjaCmd() const
return "ninja";
}
-std::string cmGlobalNinjaGenerator::CurrentNinjaVersion() const
-{
- std::string version;
- std::string command = ninjaCmd() + " --version";
- cmSystemTools::RunSingleCommand(command.c_str(),
- &version, 0, 0, 0,
- cmSystemTools::OUTPUT_NONE);
-
- return cmSystemTools::TrimWhitespace(version);
-}
-
bool cmGlobalNinjaGenerator::SupportsConsolePool() const
{
return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS,
- CurrentNinjaVersion().c_str(),
+ this->NinjaVersion.c_str(),
RequiredNinjaVersionForConsolePool().c_str()) == false;
}