diff options
author | Sylvain Joubert <joubert.sy@gmail.com> | 2014-10-02 21:21:05 +0200 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-10-03 08:48:47 -0400 |
commit | 9f32a2411b35df1d80a65a3e27e9db6faf959c91 (patch) | |
tree | 590110a64a55551693e031871f02f89d22dc0ceb /Source/cmLocalNinjaGenerator.cxx | |
parent | 99d34f46fa394a9daabb7ca959e1540ae3a41ef2 (diff) | |
download | cmake-9f32a2411b35df1d80a65a3e27e9db6faf959c91.tar.gz |
Ninja: Use 'console' pool for CMake re-run if possible (#14915)
The pre-defined 'console' pool is a non-buffered pool that runs with a
depth of 1. CMake re-run cannot be run concurrently and it will
eventually output something. A non-buffered pool allows to get it as
soon as possible
Also, generate the minimal required version of Ninja in the build file.
Diffstat (limited to 'Source/cmLocalNinjaGenerator.cxx')
-rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 2ac83635c4..5522e0d283 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -189,6 +189,7 @@ void cmLocalNinjaGenerator::WriteBuildFileTop() { // For the build file. this->WriteProjectHeader(this->GetBuildFileStream()); + this->WriteNinjaRequiredVersion(this->GetBuildFileStream()); this->WriteNinjaFilesInclusion(this->GetBuildFileStream()); // For the rule file. @@ -205,6 +206,30 @@ void cmLocalNinjaGenerator::WriteProjectHeader(std::ostream& os) cmGlobalNinjaGenerator::WriteDivider(os); } +void cmLocalNinjaGenerator::WriteNinjaRequiredVersion(std::ostream& os) +{ + // Default required version + // Ninja generator uses 'deps' and 'msvc_deps_prefix' introduced in 1.3 + std::string requiredVersion = "1.3"; + + // Ninja generator uses the 'console' pool if available (>= 1.5) + std::string usedVersion = this->GetGlobalNinjaGenerator()->ninjaVersion(); + if(cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, + usedVersion.c_str(), + "1.5") == false) + { + requiredVersion = "1.5"; + } + + cmGlobalNinjaGenerator::WriteComment(os, + "Minimal version of Ninja required by this file"); + os + << "ninja_required_version = " + << requiredVersion + << std::endl << std::endl + ; +} + void cmLocalNinjaGenerator::WritePools(std::ostream& os) { cmGlobalNinjaGenerator::WriteDivider(os); |