1
0
Эх сурвалжийг харах

Merge topic 'find_package_module_mode_print_debug_message'

b423a20ce1 FindPackage: Provide better debug message when <PKG_FOUND> is false
a7acafc977 FindPackage: find_package(MODULE) respects CMAKE_FIND_DEBUG_MODE

Acked-by: Kitware Robot <[email protected]>
Merge-request: !5256
Brad King 5 жил өмнө
parent
commit
7a4d84d8d2

+ 16 - 0
Source/cmFindPackageCommand.cxx

@@ -576,6 +576,11 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
         loadedPackage = true;
       }
     }
+
+    if (this->DebugMode) {
+      this->DebugMessage(this->DebugBuffer);
+      this->DebugBuffer.clear();
+    }
   }
 
   this->AppendSuccessInformation();
@@ -788,6 +793,17 @@ bool cmFindPackageCommand::FindModule(bool& found)
     this->Makefile->AddDefinition(var, "1");
     bool result = this->ReadListFile(mfile, DoPolicyScope);
     this->Makefile->RemoveDefinition(var);
+
+    if (this->DebugMode) {
+      std::string foundVar = cmStrCat(this->Name, "_FOUND");
+      if (this->Makefile->IsDefinitionSet(foundVar) &&
+          !this->Makefile->IsOn(foundVar)) {
+
+        this->DebugBuffer = cmStrCat(
+          this->DebugBuffer, "The module is considered not found due to ",
+          foundVar, " being FALSE.");
+      }
+    }
     return result;
   }
   return true;