summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2018-11-13 14:39:27 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2019-07-09 13:38:35 (GMT)
commit1d00ba9ccf62087016e41f237dbae7f94d3aa1f6 (patch)
tree74cf5845442a8c97f56e96c21d34851c696ff8c7 /Tests
parent704e3a2ca89a3ea75b3cf55efe9bd5d6826168da (diff)
downloadCMake-1d00ba9ccf62087016e41f237dbae7f94d3aa1f6.zip
CMake-1d00ba9ccf62087016e41f237dbae7f94d3aa1f6.tar.gz
CMake-1d00ba9ccf62087016e41f237dbae7f94d3aa1f6.tar.bz2
Find: find_package prefers variable CMAKE_FIND_USE_REGISTRY
CMake's find control flags should all have a consistent name. To make this happen we are introducing `CMAKE_FIND_USE_REGISTRY` and deprecating `CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY`.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt34
1 files changed, 31 insertions, 3 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index affe5d5..2f0c051 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -391,16 +391,44 @@ try_compile(EXPORTER_COMPILED
message(STATUS "Searching for export(PACKAGE) test project")
set(CMakeTestExportPackage_DIR "" CACHE FILEPATH
"Wipe out find results for testing." FORCE)
+
+message(STATUS "Searching for export(PACKAGE) with CMAKE_FIND_USE_PACKAGE_REGISTRY=TRUE")
+set(CMAKE_FIND_USE_PACKAGE_REGISTRY TRUE)
+find_package(CMakeTestExportPackage 1.${version} EXACT REQUIRED)
+if(NOT CMakeTestExportPackage_FOUND)
+ message(SEND_ERROR "CMakeTestExportPackage should be FOUND!")
+endif()
+unset(CMAKE_FIND_USE_PACKAGE_REGISTRY)
+
+message(STATUS "Searching for export(PACKAGE) with CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=FALSE")
+set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY FALSE)
find_package(CMakeTestExportPackage 1.${version} EXACT REQUIRED)
+if(NOT CMakeTestExportPackage_FOUND)
+ message(SEND_ERROR "CMakeTestExportPackage should be FOUND!")
+endif()
+unset(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY)
-message(STATUS "Searching for export(PACKAGE) test project with CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=TRUE")
+message(STATUS "Searching for export(PACKAGE) with CMAKE_FIND_USE_PACKAGE_REGISTRY=TRUE and CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=TRUE")
+set(CMAKE_FIND_USE_PACKAGE_REGISTRY TRUE)
set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY TRUE)
+set(CMakeTestExportPackage_DIR FALSE)
+find_package(CMakeTestExportPackage 1.${version} EXACT REQUIRED)
+if(NOT CMakeTestExportPackage_FOUND)
+ message(SEND_ERROR "CMakeTestExportPackage should be FOUND!")
+endif()
+unset(CMAKE_FIND_USE_PACKAGE_REGISTRY)
+unset(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY)
+
+message(STATUS "Searching for export(PACKAGE) with CMAKE_FIND_USE_PACKAGE_REGISTRY=FALSE and CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=FALSE")
+set(CMAKE_FIND_USE_PACKAGE_REGISTRY FALSE)
+set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY FALSE)
set(CMakeTestExportPackage_DIR "" CACHE FILEPATH
"Wipe out find results for testing." FORCE)
-find_package(CMakeTestExportPackage 1.${version} EXACT QUIET)
+find_package(CMakeTestExportPackage 1.${version} EXACT QUIET)
if(CMakeTestExportPackage_FOUND)
- message(SEND_ERROR "CMakeTestExportPackage should not be FOUND!")
+ message(SEND_ERROR "CMakeTestExportPackage should be not FOUND!")
endif()
+unset(CMAKE_FIND_USE_PACKAGE_REGISTRY)
unset(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY)
message(STATUS "Remove export(PACKAGE) test project")