فهرست منبع

Merge topic 'cxxmodules-ninja-1.11' into release-3.25

0512428ad9 Ninja: require Ninja 1.11 for C++ module support

Acked-by: Kitware Robot <[email protected]>
Merge-request: !8099
Brad King 2 سال پیش
والد
کامیت
3563d461dd

+ 12 - 8
Source/cmGlobalNinjaGenerator.cxx

@@ -738,10 +738,13 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures()
   this->NinjaSupportsMultilineDepfile =
     !cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, this->NinjaVersion,
                                    RequiredNinjaVersionForMultilineDepfile());
-  this->NinjaSupportsDyndeps =
+  this->NinjaSupportsDyndepsCxx =
     !cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, this->NinjaVersion,
-                                   RequiredNinjaVersionForDyndeps());
-  if (!this->NinjaSupportsDyndeps) {
+                                   RequiredNinjaVersionForDyndepsCxx());
+  this->NinjaSupportsDyndepsFortran =
+    !cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, this->NinjaVersion,
+                                   RequiredNinjaVersionForDyndepsFortran());
+  if (!this->NinjaSupportsDyndepsFortran) {
     // The ninja version number is not new enough to have upstream support.
     // Our ninja branch adds ".dyndep-#" to its version number,
     // where '#' is a feature-specific version number.  Extract it.
@@ -752,7 +755,7 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures()
       unsigned long dyndep = 0;
       cmStrToULong(fv, &dyndep);
       if (dyndep == 1) {
-        this->NinjaSupportsDyndeps = true;
+        this->NinjaSupportsDyndepsFortran = true;
       }
     }
   }
@@ -860,7 +863,7 @@ bool cmGlobalNinjaGenerator::CheckCxxModuleSupport()
       "C++20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP "
       "is experimental.  It is meant only for compiler developers to try.");
   }
-  if (this->NinjaSupportsDyndeps) {
+  if (this->NinjaSupportsDyndepsCxx) {
     return true;
   }
   if (diagnose) {
@@ -871,7 +874,7 @@ bool cmGlobalNinjaGenerator::CheckCxxModuleSupport()
       "using Ninja version \n"
       "  " << this->NinjaVersion << "\n"
       "due to lack of required features.  "
-      "Ninja " << RequiredNinjaVersionForDyndeps() << " or higher is required."
+      "Ninja " << RequiredNinjaVersionForDyndepsCxx() << " or higher is required."
       ;
     /* clang-format on */
     this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e.str());
@@ -882,7 +885,7 @@ bool cmGlobalNinjaGenerator::CheckCxxModuleSupport()
 
 bool cmGlobalNinjaGenerator::CheckFortran(cmMakefile* mf) const
 {
-  if (this->NinjaSupportsDyndeps) {
+  if (this->NinjaSupportsDyndepsFortran) {
     return true;
   }
 
@@ -892,7 +895,8 @@ bool cmGlobalNinjaGenerator::CheckFortran(cmMakefile* mf) const
     "The Ninja generator does not support Fortran using Ninja version\n"
     "  " << this->NinjaVersion << "\n"
     "due to lack of required features.  "
-    "Ninja " << RequiredNinjaVersionForDyndeps() << " or higher is required."
+    "Ninja " << RequiredNinjaVersionForDyndepsFortran() <<
+    " or higher is required."
     ;
   /* clang-format on */
   mf->IssueMessage(MessageType::FATAL_ERROR, e.str());

+ 4 - 2
Source/cmGlobalNinjaGenerator.h

@@ -393,7 +393,8 @@ public:
   {
     return "1.9";
   }
-  static std::string RequiredNinjaVersionForDyndeps() { return "1.10"; }
+  static std::string RequiredNinjaVersionForDyndepsCxx() { return "1.11"; }
+  static std::string RequiredNinjaVersionForDyndepsFortran() { return "1.10"; }
   static std::string RequiredNinjaVersionForRestatTool() { return "1.10"; }
   static std::string RequiredNinjaVersionForUnconditionalRecompactTool()
   {
@@ -583,7 +584,8 @@ private:
   bool NinjaSupportsImplicitOuts = false;
   bool NinjaSupportsManifestRestat = false;
   bool NinjaSupportsMultilineDepfile = false;
-  bool NinjaSupportsDyndeps = false;
+  bool NinjaSupportsDyndepsCxx = false;
+  bool NinjaSupportsDyndepsFortran = false;
   bool NinjaSupportsRestatTool = false;
   bool NinjaSupportsUnconditionalRecompactTool = false;
   bool NinjaSupportsMultipleOutputs = false;

+ 1 - 1
Tests/RunCMake/CXXModules/NoDyndepSupport-stderr.txt

@@ -15,7 +15,7 @@ CMake Error:
 
     .*
 
-  due to lack of required features.  Ninja 1.10 or higher is required.
+  due to lack of required features.  Ninja 1.11 or higher is required.
 
 |CMake Error in CMakeLists.txt:
   The "nodyndep" target contains C\+\+ module sources which are not supported

+ 1 - 1
Tests/RunCMake/CXXModules/RunCMakeTest.cmake

@@ -38,7 +38,7 @@ endif ()
 
 # Test behavior when the generator does not support C++20 modules.
 if (NOT RunCMake_GENERATOR MATCHES "Ninja" OR
-    ninja_version VERSION_LESS "1.10" OR
+    ninja_version VERSION_LESS "1.11" OR
     NOT "cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
   if ("cxx_std_20" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
     run_cmake(NoDyndepSupport)