diff options
author | Brad King <brad.king@kitware.com> | 2019-07-17 11:20:06 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-07-17 11:20:20 (GMT) |
commit | 3f84ff212c2e5ff9410dcd75f7806832472a756d (patch) | |
tree | 237a1aec465fe62ec6ad72d042c1fbb08e934d05 /Tests/FindPackageTest | |
parent | b1199680489b402e3b73229d79eb06e3bd440f81 (diff) | |
parent | f2edccea666662ce93af29e397c50702a675f3f4 (diff) | |
download | CMake-3f84ff212c2e5ff9410dcd75f7806832472a756d.zip CMake-3f84ff212c2e5ff9410dcd75f7806832472a756d.tar.gz CMake-3f84ff212c2e5ff9410dcd75f7806832472a756d.tar.bz2 |
Merge topic 'find_package-fix-NO_MODULE'
f2edccea66 find_package: Fix NO_MODULE under CMAKE_FIND_PACKAGE_PREFER_CONFIG
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3557
Diffstat (limited to 'Tests/FindPackageTest')
-rw-r--r-- | Tests/FindPackageTest/CMakeLists.txt | 33 | ||||
-rw-r--r-- | Tests/FindPackageTest/PreferConfigRecurse/ACMEConfig.cmake | 1 | ||||
-rw-r--r-- | Tests/FindPackageTest/PreferConfigRecurse/FindACME.cmake | 1 |
3 files changed, 35 insertions, 0 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 2f0c051..519608c 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -607,6 +607,26 @@ endif() set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF) set(CMAKE_PREFIX_PATH) +set(CMAKE_MODULE_PATH) + +############################################################################ +##Test FIND_PACKAGE CMAKE_FIND_PACKAGE_PREFER_CONFIG - Do not recurse + +# No CMAKE_PREFIX_PATH +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/PreferConfigRecurse) + +# Now prefer config mode +set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON) +unset(ACME_FOUND) +unset(ACME_CONFIG) + +find_package(ACME) +if(ACME_FOUND AND ACME_CONFIG) + message(SEND_ERROR "Incorrectly found ACME in CONFIG mode, from the MODULE package") +endif() + +set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF) +set(CMAKE_MODULE_PATH) ############################################################################ ##Test find_package CMAKE_FIND_PACKAGE_PREFER_CONFIG with module fallback @@ -620,3 +640,16 @@ find_package(ACME REQUIRED) if(NOT ACME_FOUND) message(SEND_ERROR "Did not find ACME package") endif() + +############################################################################ +##Test find_package CMAKE_FIND_PACKAGE_PREFER_CONFIG with NO_MODULE + +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/PreferConfigOnlyModule) + +set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON) + +find_package(ACME NO_MODULE) + +if(ACME_FOUND) + message(SEND_ERROR "Should not find ACME package") +endif() diff --git a/Tests/FindPackageTest/PreferConfigRecurse/ACMEConfig.cmake b/Tests/FindPackageTest/PreferConfigRecurse/ACMEConfig.cmake new file mode 100644 index 0000000..7a4e1b3 --- /dev/null +++ b/Tests/FindPackageTest/PreferConfigRecurse/ACMEConfig.cmake @@ -0,0 +1 @@ +set(ACME_FOUND TRUE) diff --git a/Tests/FindPackageTest/PreferConfigRecurse/FindACME.cmake b/Tests/FindPackageTest/PreferConfigRecurse/FindACME.cmake new file mode 100644 index 0000000..9bdc7db --- /dev/null +++ b/Tests/FindPackageTest/PreferConfigRecurse/FindACME.cmake @@ -0,0 +1 @@ +find_package(ACME NO_MODULE) |