summaryrefslogtreecommitdiffstats
path: root/Source/cmFindPackageCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-04-07 19:36:05 (GMT)
committerBrad King <brad.king@kitware.com>2011-04-07 19:36:05 (GMT)
commit9fc7ea4c620e849a719ea23ea6faff17f1d67ee6 (patch)
treeed9e31f58bcef7e9b56ebd2104b9ed906b3dd749 /Source/cmFindPackageCommand.cxx
parentc2f8a137152d9dc4cc08b156284f916561e1455c (diff)
downloadCMake-9fc7ea4c620e849a719ea23ea6faff17f1d67ee6.zip
CMake-9fc7ea4c620e849a719ea23ea6faff17f1d67ee6.tar.gz
CMake-9fc7ea4c620e849a719ea23ea6faff17f1d67ee6.tar.bz2
find_package: Forward component list for recursive calls in modules
Some find modules call find_package recursively to locate a package configuration file for the package instead of searching for individual pieces. Commit 79e9b755 (Help recursive find_package calls in modules, 2008-10-03) taught find_package to forward the version number and EXACT arguments through the recursive call automatically. Do the same for the component list.
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
-rw-r--r--Source/cmFindPackageCommand.cxx37
1 files changed, 23 insertions, 14 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index fdc1a01..d3c4bc7 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -101,9 +101,10 @@ void cmFindPackageCommand::GenerateDocumentation()
"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. "
- "If no [version] is given to a recursive invocation inside a "
- "find-module, the [version] and EXACT arguments are forwarded "
- "automatically from the outer call. "
+ "If no [version] and/or component list is given to a recursive "
+ "invocation inside a find-module, the corresponding arguments "
+ "are forwarded automatically from the outer call (including the "
+ "EXACT flag for [version]). "
"Version support is currently provided only on a package-by-package "
"basis (details below).\n"
"User code should generally look for packages using the above simple "
@@ -524,7 +525,7 @@ bool cmFindPackageCommand
cmake::AUTHOR_WARNING, "Ignoring EXACT since no version is requested.");
}
- if(this->Version.empty())
+ if(this->Version.empty() || components.empty())
{
// Check whether we are recursing inside "Find<name>.cmake" within
// another find_package(<name>) call.
@@ -532,16 +533,24 @@ bool cmFindPackageCommand
mod += "_FIND_MODULE";
if(this->Makefile->IsOn(mod.c_str()))
{
- // Get version information from the outer call if necessary.
- // Requested version string.
- std::string ver = this->Name;
- ver += "_FIND_VERSION";
- this->Version = this->Makefile->GetSafeDefinition(ver.c_str());
-
- // Whether an exact version is required.
- std::string exact = this->Name;
- exact += "_FIND_VERSION_EXACT";
- this->VersionExact = this->Makefile->IsOn(exact.c_str());
+ if(this->Version.empty())
+ {
+ // Get version information from the outer call if necessary.
+ // Requested version string.
+ std::string ver = this->Name;
+ ver += "_FIND_VERSION";
+ this->Version = this->Makefile->GetSafeDefinition(ver.c_str());
+
+ // Whether an exact version is required.
+ std::string exact = this->Name;
+ exact += "_FIND_VERSION_EXACT";
+ this->VersionExact = this->Makefile->IsOn(exact.c_str());
+ }
+ if(components.empty())
+ {
+ std::string components_var = this->Name + "_FIND_COMPONENTS";
+ components = this->Makefile->GetSafeDefinition(components_var.c_str());
+ }
}
}