Explorar o código

Merge topic 'find-package-event-providers'

3d60b0ba1d configure-log: fill in dependency provider information

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !10785
Brad King hai 5 meses
pai
achega
edb80c068b
Modificáronse 2 ficheiros con 16 adicións e 2 borrados
  1. 5 2
      Help/manual/cmake-configure-log.7.rst
  2. 11 0
      Source/cmFindPackageCommand.cxx

+ 5 - 2
Help/manual/cmake-configure-log.7.rst

@@ -668,7 +668,8 @@ The keys specific to ``find_package-v1`` mappings are:
   keys:
 
   ``path``
-    The path to the considered file.
+    The path to the considered file. In the case of a dependency provider, the
+    value is in the form of ``dependency_provider::<COMMAND_NAME>``.
 
   ``mode``
     The mode which found the file. One of ``module``, ``cps``, ``cmake``, or
@@ -687,7 +688,9 @@ The keys specific to ``find_package-v1`` mappings are:
   found, this is ``null``. Keys available:
 
   ``path``
-    The path to the module or configuration that found the package.
+    The path to the module or configuration that found the package. In the
+    case of a dependency provider, the value is in the form of
+    ``dependency_provider::<COMMAND_NAME>``.
 
   ``mode``
     The mode that considered the path. One of ``module``, ``cps``, ``cmake``,

+ 11 - 0
Source/cmFindPackageCommand.cxx

@@ -1121,13 +1121,24 @@ bool cmFindPackageCommand::FindPackage(
     if (!providerCommand(listFileArgs, this->Status)) {
       return false;
     }
+    std::string providerName;
+    if (auto depProvider = state->GetDependencyProvider()) {
+      providerName = depProvider->GetCommand();
+    } else {
+      providerName = "<no provider?>";
+    }
+    auto searchPath = cmStrCat("dependency_provider::", providerName);
     if (this->Makefile->IsOn(cmStrCat(this->Name, "_FOUND"))) {
       if (this->DebugModeEnabled()) {
         this->DebugMessage("Package was found by the dependency provider");
       }
+      this->FileFound = searchPath;
+      this->FileFoundMode = FoundPackageMode::Provider;
       this->AppendSuccessInformation();
       return true;
     }
+    this->ConsideredPaths.emplace_back(searchPath, FoundPackageMode::Provider,
+                                       SearchResult::NotFound);
   }
 
   // Limit package nesting depth well below the recursion depth limit because