summaryrefslogtreecommitdiffstats
path: root/Tests/FindPackageTest
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@gmail.com>2019-06-13 21:58:30 (GMT)
committerCristian Adam <cristian.adam@gmail.com>2019-06-13 21:58:30 (GMT)
commit22e65d10c175081ed5f21f86c7064c014fc3f39c (patch)
treea673d33900c33c132c1528072064cc1ec4970f57 /Tests/FindPackageTest
parenta4231943117f5ba3dd0fdc6c8b1824334162b69f (diff)
downloadCMake-22e65d10c175081ed5f21f86c7064c014fc3f39c.zip
CMake-22e65d10c175081ed5f21f86c7064c014fc3f39c.tar.gz
CMake-22e65d10c175081ed5f21f86c7064c014fc3f39c.tar.bz2
find_package: Fixed CMAKE_FIND_PACKAGE_PREFER_CONFIG Module fallback
Fixes: #19361
Diffstat (limited to 'Tests/FindPackageTest')
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt13
-rw-r--r--Tests/FindPackageTest/PreferConfigOnlyModule/FindACME.cmake1
2 files changed, 14 insertions, 0 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index 8802b73..affe5d5 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -579,3 +579,16 @@ endif()
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG OFF)
set(CMAKE_PREFIX_PATH)
+
+############################################################################
+##Test find_package CMAKE_FIND_PACKAGE_PREFER_CONFIG with module fallback
+
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/PreferConfigOnlyModule)
+
+set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
+
+find_package(ACME REQUIRED)
+
+if(NOT ACME_FOUND)
+ message(SEND_ERROR "Did not find ACME package")
+endif()
diff --git a/Tests/FindPackageTest/PreferConfigOnlyModule/FindACME.cmake b/Tests/FindPackageTest/PreferConfigOnlyModule/FindACME.cmake
new file mode 100644
index 0000000..7a4e1b3
--- /dev/null
+++ b/Tests/FindPackageTest/PreferConfigOnlyModule/FindACME.cmake
@@ -0,0 +1 @@
+set(ACME_FOUND TRUE)