ソースを参照

configure-log: fill in dependency provider information

This uses the special "path" of `dependency_provider::…` to indicate the
provider in use.
Ben Boeckel 5 ヶ月 前
コミット
3d60b0ba1d
2 ファイル変更16 行追加2 行削除
  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

@@ -654,7 +654,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
@@ -673,7 +674,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