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.
This commit is contained in:
parent
4f5a8b9c0c
commit
e51969ac49
|
@ -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);
|
||||
|
|
|
@ -85,12 +85,12 @@ SET(TApp_EXPECTED
|
|||
SET(Tapp_EXPECTED
|
||||
"TApp.app/Contents/Resources/cmake/tapp-config.cmake")
|
||||
SET(VersionedA_EXPECTED "lib/zot-2.0/zot-config.cmake")
|
||||
SET(VersionedB_EXPECTED "lib/zot-3.1/zot-config.cmake")
|
||||
SET(VersionedB_EXPECTED "lib/cmake/zot-3.1/zot-config.cmake")
|
||||
SET(wibbleA_EXPECTED "A/wibble-config.cmake")
|
||||
SET(wibbleB_EXPECTED "B/wibble-config.cmake")
|
||||
SET(RecursiveA_EXPECTED "lib/RecursiveA/recursivea-config.cmake")
|
||||
SET(RecursiveB_EXPECTED "lib/zot-2.0/zot-config.cmake")
|
||||
SET(RecursiveC_EXPECTED "lib/zot-3.1/zot-config.cmake")
|
||||
SET(RecursiveC_EXPECTED "lib/cmake/zot-3.1/zot-config.cmake")
|
||||
|
||||
# Check the results.
|
||||
FOREACH(p ${PACKAGES})
|
||||
|
|
Loading…
Reference in New Issue