summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalNinjaGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmLocalNinjaGenerator.cxx')
-rw-r--r--Source/cmLocalNinjaGenerator.cxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 2ac8363..5522e0d 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);