[cmake-developers] Package Config files with COMPONENTS

Brad King brad.king at kitware.com
Tue Mar 20 08:36:17 EDT 2012


On 3/19/2012 5:17 PM, Alexander Neundorf wrote:
> On Monday 19 March 2012, Brad King wrote:
>> Thanks.  I rewrote the topic on the stage to clean up the history a little
>> and rebase it on top of the rewritten version of the other
>> find_package_set_FOUND_VariableInConfigFile topic.
>
> Hmm, I thought I had done that.
> I had deleted my local find_package_set_FOUND_VariableInConfigFile branch,
> then did git pull, then created a tracking branch from the remote branch, and
> branched away from this.

Did you pull from origin or fetch from stage?  The latter was necessary.

>> Please take a look at the new version of the topic.
>
> Is there a way to see what you changed ?

Compare the old head to the new head of the branch:

$ git fetch stage --prune
$ git diff e0694f64 stage/ImprovedCOMPONENTSSupportInFindPackage2

Note that because I rebased it on the modified version of the other
topic you will see those changes too.  I pasted the relevant diff
below between your version and mine.

-Brad


diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 05eb07d..ef16ce8 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -99,15 +99,14 @@ void cmFindPackageCommand::GenerateDocumentation()
      "The QUIET option disables messages if the package cannot be found.  "
      "The MODULE option disables the second signature documented below.  "
      "The REQUIRED option stops processing with an error message if the "
-    "package cannot be found.  "
+    "package cannot be found."
+    "\n"
      "A package-specific list of required components may be listed after the "
      "COMPONENTS option or directly after the REQUIRED option.  "
-    "A package should only be considered found if all of the listed "
-    "components have been found.  "
-    "Additional package-specific optional components may be listed after the "
-    "OPTIONAL_COMPONENTS option.  As opposed to the COMPONENTS option, the "
-    "result for those components does not influence whether the package as a "
-    "whole is considered to be found. "
+    "Additional optional components may be listed after OPTIONAL_COMPONENTS.  "
+    "Available components and their influence on whether a package is "
+    "considered to be found are defined by the target package."
+    "\n"
      "The [version] argument requests a version with which the package found "
      "should be compatible (format is major[.minor[.patch[.tweak]]]).  "
      "The EXACT option requests that the version be matched exactly.  "
@@ -612,18 +611,14 @@ bool cmFindPackageCommand
    std::set_intersection(requiredComponents.begin(), requiredComponents.end(),
                          optionalComponents.begin(), optionalComponents.end(),
                          std::back_inserter(doubledComponents));
-
-  if(doubledComponents.size() > 0)
+  if(!doubledComponents.empty())
      {
-
      cmOStringStream e;
-    e << "called with the following components used for both COMPONENTS and "
-          "OPTIONAL_COMPONENTS: ";
+    e << "called with components that are both required and optional:\n";
      for(unsigned int i=0; i<doubledComponents.size(); ++i)
        {
-      e << doubledComponents[i] << " ";
+      e << "  " << doubledComponents[i] << "\n";
        }
-
      this->SetError(e.str().c_str());
      return false;
      }



More information about the cmake-developers mailing list