diff options
author | Brad King <brad.king@kitware.com> | 2016-08-24 13:45:47 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-08-24 13:45:47 (GMT) |
commit | ccddb454b8e7ae3ae075db5fd3233ce86c8c70cb (patch) | |
tree | bd725b0ee02b42c32461d2c248c5823125d0b260 | |
parent | 4a2a66e31c4b7fbcc6bbe41219a6c7f0624dc165 (diff) | |
parent | 828d6c137d703ea095008fc6da794904a15c4ebd (diff) | |
download | CMake-ccddb454b8e7ae3ae075db5fd3233ce86c8c70cb.zip CMake-ccddb454b8e7ae3ae075db5fd3233ce86c8c70cb.tar.gz CMake-ccddb454b8e7ae3ae075db5fd3233ce86c8c70cb.tar.bz2 |
Merge topic 'extend-find-package-search-path'
828d6c13 find_package: Extend search path for combined Windows/UNIX convention
ff5c89de Help: Widen find_package search path table
9 files changed, 82 insertions, 9 deletions
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index 58dff9d..c44fe86 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -194,13 +194,16 @@ configuration file. The tables below show the directories searched. Each entry is meant for installation trees following Windows (W), UNIX (U), or Apple (A) conventions:: - <prefix>/ (W) - <prefix>/(cmake|CMake)/ (W) - <prefix>/<name>*/ (W) - <prefix>/<name>*/(cmake|CMake)/ (W) - <prefix>/(lib/<arch>|lib|share)/cmake/<name>*/ (U) - <prefix>/(lib/<arch>|lib|share)/<name>*/ (U) - <prefix>/(lib/<arch>|lib|share)/<name>*/(cmake|CMake)/ (U) + <prefix>/ (W) + <prefix>/(cmake|CMake)/ (W) + <prefix>/<name>*/ (W) + <prefix>/<name>*/(cmake|CMake)/ (W) + <prefix>/(lib/<arch>|lib|share)/cmake/<name>*/ (U) + <prefix>/(lib/<arch>|lib|share)/<name>*/ (U) + <prefix>/(lib/<arch>|lib|share)/<name>*/(cmake|CMake)/ (U) + <prefix>/<name>*/(lib/<arch>|lib|share)/cmake/<name>*/ (W/U) + <prefix>/<name>*/(lib/<arch>|lib|share)/<name>*/ (W/U) + <prefix>/<name>*/(lib/<arch>|lib|share)/<name>*/(cmake|CMake)/ (W/U) On systems supporting OS X Frameworks and Application Bundles the following directories are searched for frameworks or bundles diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 260079b..8338c2a 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1961,6 +1961,44 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) } } + // PREFIX/(Foo|foo|FOO).*/(lib/ARCH|lib|share)/cmake/(Foo|foo|FOO).*/ + { + cmFindPackageFileList lister(this); + lister / cmFileListGeneratorFixed(prefix) / + cmFileListGeneratorProject(this->Names) / + cmFileListGeneratorEnumerate(common) / + cmFileListGeneratorFixed("cmake") / + cmFileListGeneratorProject(this->Names); + if (lister.Search()) { + return true; + } + } + + // PREFIX/(Foo|foo|FOO).*/(lib/ARCH|lib|share)/(Foo|foo|FOO).*/ + { + cmFindPackageFileList lister(this); + lister / cmFileListGeneratorFixed(prefix) / + cmFileListGeneratorProject(this->Names) / + cmFileListGeneratorEnumerate(common) / + cmFileListGeneratorProject(this->Names); + if (lister.Search()) { + return true; + } + } + + // PREFIX/(Foo|foo|FOO).*/(lib/ARCH|lib|share)/(Foo|foo|FOO).*/(cmake|CMake)/ + { + cmFindPackageFileList lister(this); + lister / cmFileListGeneratorFixed(prefix) / + cmFileListGeneratorProject(this->Names) / + cmFileListGeneratorEnumerate(common) / + cmFileListGeneratorProject(this->Names) / + cmFileListGeneratorCaseInsensitive("cmake"); + if (lister.Search()) { + return true; + } + } + return false; } diff --git a/Tests/FindPackageTest/Baz 1.3/lib/cmake/Baz/BazConfig.cmake b/Tests/FindPackageTest/Baz 1.3/lib/cmake/Baz/BazConfig.cmake new file mode 100644 index 0000000..deffa57 --- /dev/null +++ b/Tests/FindPackageTest/Baz 1.3/lib/cmake/Baz/BazConfig.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/Baz 1.3/lib/cmake/Baz/BazConfigVersion.cmake b/Tests/FindPackageTest/Baz 1.3/lib/cmake/Baz/BazConfigVersion.cmake new file mode 100644 index 0000000..d8cac77 --- /dev/null +++ b/Tests/FindPackageTest/Baz 1.3/lib/cmake/Baz/BazConfigVersion.cmake @@ -0,0 +1,7 @@ +set(PACKAGE_VERSION 1.3) +if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1) + set(PACKAGE_VERSION_COMPATIBLE 1) + if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 3) + set(PACKAGE_VERSION_EXACT 1) + endif() +endif() diff --git a/Tests/FindPackageTest/Baz 2.0/share/Baz 2/BazConfig.cmake b/Tests/FindPackageTest/Baz 2.0/share/Baz 2/BazConfig.cmake new file mode 100644 index 0000000..deffa57 --- /dev/null +++ b/Tests/FindPackageTest/Baz 2.0/share/Baz 2/BazConfig.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/Baz 2.0/share/Baz 2/BazConfigVersion.cmake b/Tests/FindPackageTest/Baz 2.0/share/Baz 2/BazConfigVersion.cmake new file mode 100644 index 0000000..5026fad --- /dev/null +++ b/Tests/FindPackageTest/Baz 2.0/share/Baz 2/BazConfigVersion.cmake @@ -0,0 +1,7 @@ +set(PACKAGE_VERSION 2.0) +if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 2) + set(PACKAGE_VERSION_COMPATIBLE 1) + if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 0) + set(PACKAGE_VERSION_EXACT 1) + endif() +endif() diff --git a/Tests/FindPackageTest/Baz 2.1/lib/Baz 2/cmake/BazConfig.cmake b/Tests/FindPackageTest/Baz 2.1/lib/Baz 2/cmake/BazConfig.cmake new file mode 100644 index 0000000..deffa57 --- /dev/null +++ b/Tests/FindPackageTest/Baz 2.1/lib/Baz 2/cmake/BazConfig.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/Baz 2.1/lib/Baz 2/cmake/BazConfigVersion.cmake b/Tests/FindPackageTest/Baz 2.1/lib/Baz 2/cmake/BazConfigVersion.cmake new file mode 100644 index 0000000..a180143 --- /dev/null +++ b/Tests/FindPackageTest/Baz 2.1/lib/Baz 2/cmake/BazConfigVersion.cmake @@ -0,0 +1,7 @@ +set(PACKAGE_VERSION 2.1) +if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 2) + set(PACKAGE_VERSION_COMPATIBLE 1) + if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) + set(PACKAGE_VERSION_EXACT 1) + endif() +endif() diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index d3e68bc..04bbbc6 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -102,6 +102,7 @@ endif() set(PACKAGES foo Foo Bar Blub TFramework Tframework TApp Tapp Special VersionedA VersionedB VersionedC VersionedD VersionedE + VersionedF VersionedG VersionedH WrongA WrongB WrongC WrongD wibbleA wibbleB RecursiveA RecursiveB RecursiveC @@ -142,6 +143,10 @@ find_package(VersionedB 3.1 EXACT NAMES zot) find_package(VersionedC 4.0 EXACT NAMES zot) find_package(VersionedD 1.1 EXACT NAMES Baz) find_package(VersionedE 1.2 EXACT NAMES Baz) +find_package(VersionedF 1.3 EXACT NAMES Baz) +find_package(VersionedG 2.0 EXACT NAMES Baz) +find_package(VersionedH 2.1 EXACT NAMES Baz) + # Test Config files which set Xyz_FOUND themselves: find_package(SetFoundTRUE NO_MODULE) @@ -158,12 +163,12 @@ find_package(WrongB 1.2 EXACT NAMES Baz) # Test wrong initial path when result is missing. set(WrongC_DIR "${VersionedD_DIR}") -find_package(WrongC 1.3 EXACT QUIET NAMES Baz) +find_package(WrongC 1.4 EXACT QUIET NAMES Baz) # Test wrong initial cache entry of UNINITIALIZED type when result is missing. set(WrongD_DIR "${VersionedD_DIR}" CACHE UNINITIALIZED "Wrong Value" FORCE) get_property(type CACHE WrongD_DIR PROPERTY TYPE) -find_package(WrongD 1.3 EXACT QUIET NAMES Baz) +find_package(WrongD 1.4 EXACT QUIET NAMES Baz) # HINTS should override the system but PATHS should not list(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/A") @@ -216,6 +221,9 @@ set(VersionedB_EXPECTED "lib/zot-3.1/zot-config.cmake") set(VersionedC_EXPECTED "lib/cmake/zot-4.0/zot-config.cmake") set(VersionedD_EXPECTED "Baz 1.1/BazConfig.cmake") set(VersionedE_EXPECTED "Baz 1.2/CMake/BazConfig.cmake") +set(VersionedF_EXPECTED "Baz 1.3/lib/cmake/Baz/BazConfig.cmake") +set(VersionedG_EXPECTED "Baz 2.0/share/Baz 2/BazConfig.cmake") +set(VersionedH_EXPECTED "Baz 2.1/lib/Baz 2/cmake/BazConfig.cmake") set(WrongA_EXPECTED "${VersionedE_EXPECTED}") set(WrongB_EXPECTED "${VersionedE_EXPECTED}") set(WrongC_MISSING "WrongC_DIR-NOTFOUND") |