Преглед изворни кода

Ninja: Prevent generating if installed Ninja version is too old.

James Johnston пре 10 година
родитељ
комит
874e70bc57
1 измењених фајлова са 12 додато и 0 уклоњено
  1. 12 0
      Source/cmGlobalNinjaGenerator.cxx

+ 12 - 0
Source/cmGlobalNinjaGenerator.cxx

@@ -547,6 +547,18 @@ void cmGlobalNinjaGenerator
 //   Source/cmake.cxx
 void cmGlobalNinjaGenerator::Generate()
 {
+  // Check minimum Ninja version.
+  if (cmSystemTools::VersionCompare(cmSystemTools::OP_LESS,
+                                    CurrentNinjaVersion().c_str(),
+                                    RequiredNinjaVersion().c_str()))
+    {
+    std::ostringstream msg;
+    msg << "The detected version of Ninja (" << this->CurrentNinjaVersion();
+    msg << ") is less than the version of Ninja required by CMake (";
+    msg << this->RequiredNinjaVersion() << ").";
+    this->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, msg.str());
+    return;
+    }
   this->OpenBuildFileStream();
   this->OpenRulesFileStream();