summaryrefslogtreecommitdiffstats
path: root/Source/cmFindPackageCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-12-09 19:07:19 (GMT)
committerBrad King <brad.king@kitware.com>2008-12-09 19:07:19 (GMT)
commite51969ac4935999779be2cb8b74a06b218d73dd0 (patch)
tree6c77b95571928b1dad028ebd6a7f250d6658a105 /Source/cmFindPackageCommand.cxx
parent4f5a8b9c0c5d72837981880c5a795d69acd73dac (diff)
downloadCMake-e51969ac4935999779be2cb8b74a06b218d73dd0.zip
CMake-e51969ac4935999779be2cb8b74a06b218d73dd0.tar.gz
CMake-e51969ac4935999779be2cb8b74a06b218d73dd0.tar.bz2
ENH: Add useful search locations to find_package
This teaches find_package to search <prefix>/(share|lib)/cmake/<name>*/ for package configuration files. Packages that do not already have files in a <prefix>/lib/<name>* directory can use this location to avoid cluttering the lib directory.
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
-rw-r--r--Source/cmFindPackageCommand.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 7c326ff..78b73fd 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -222,6 +222,7 @@ cmFindPackageCommand::cmFindPackageCommand()
"UNIX (U), or Apple (A) conventions.\n"
" <prefix>/ (W)\n"
" <prefix>/(cmake|CMake)/ (W)\n"
+ " <prefix>/(share|lib)/cmake/<name>*/ (U)\n"
" <prefix>/(share|lib)/<name>*/ (U)\n"
" <prefix>/(share|lib)/<name>*/(cmake|CMake)/ (U)\n"
"On systems supporting OS X Frameworks and Application Bundles "
@@ -1789,6 +1790,20 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
common.push_back("lib");
common.push_back("share");
+ // PREFIX/(share|lib)/cmake/(Foo|foo|FOO).*/
+ {
+ cmFindPackageFileList lister(this);
+ lister
+ / cmFileListGeneratorFixed(prefix)
+ / cmFileListGeneratorEnumerate(common)
+ / cmFileListGeneratorFixed("cmake")
+ / cmFileListGeneratorProject(this->Names);
+ if(lister.Search())
+ {
+ return true;
+ }
+ }
+
// PREFIX/(share|lib)/(Foo|foo|FOO).*/
{
cmFindPackageFileList lister(this);