diff options
author | Daniele E. Domenichelli <daniele.domenichelli@iit.it> | 2014-04-02 14:32:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-05-12 13:50:01 (GMT) |
commit | be8ae96098c58cf96ed71badba94e7b45f273f3c (patch) | |
tree | beac603dc9dbfe83ec71db2b8aae5bc54ccce8d6 /Tests/FindPackageTest/CMakeLists.txt | |
parent | d09fda5d91e92155ef674dde97a66547cc750e9f (diff) | |
download | CMake-be8ae96098c58cf96ed71badba94e7b45f273f3c.zip CMake-be8ae96098c58cf96ed71badba94e7b45f273f3c.tar.gz CMake-be8ae96098c58cf96ed71badba94e7b45f273f3c.tar.bz2 |
Allow the Package Registry to be disabled (#14849)
When a project is packaged for redistribution the local package
registries should not be updated or consulted. They are for developers.
Add variables to disable use of package registries globally:
* CMAKE_EXPORT_NO_PACKAGE_REGISTRY that disables the export(PACKAGE)
command
* CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY that disables the User Package
Registry in all the find_package calls.
* CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY that disables the
System Package Registry in all the find_package calls.
Update documentation and unit tests.
Diffstat (limited to 'Tests/FindPackageTest/CMakeLists.txt')
-rw-r--r-- | Tests/FindPackageTest/CMakeLists.txt | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 092801b..092bf20 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -331,7 +331,7 @@ try_compile(EXPORTER_COMPILED ${FindPackageTest_BINARY_DIR}/Exporter-build ${FindPackageTest_SOURCE_DIR}/Exporter CMakeTestExportPackage dummy - CMAKE_FLAGS + CMAKE_FLAGS "-UCMAKE_EXPORT_NO_PACKAGE_REGISTRY" -Dversion=${version} OUTPUT_VARIABLE output) message(STATUS "Searching for export(PACKAGE) test project") @@ -339,6 +339,36 @@ set(CMakeTestExportPackage_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE) find_package(CMakeTestExportPackage 1.${version} EXACT REQUIRED) +message(STATUS "Searching for export(PACKAGE) test project with CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=TRUE") +set(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY TRUE) +set(CMakeTestExportPackage_DIR "" CACHE FILEPATH + "Wipe out find results for testing." FORCE) +find_package(CMakeTestExportPackage 1.${version} EXACT QUIET) +if(CMakeTestExportPackage_FOUND) + message(SEND_ERROR "CMakeTestExportPackage should not be FOUND!") +endif() +unset(CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY) + +message(STATUS "Remove export(PACKAGE) test project") +file(REMOVE_RECURSE ${FindPackageTest_BINARY_DIR}/Exporter-build) +set(CMakeTestExportPackage_DIR "" CACHE FILEPATH + "Wipe out find results for testing." FORCE) +find_package(CMakeTestExportPackage QUIET) # Should clean the user package cache +# +message(STATUS "Preparing export(PACKAGE) test project with CMAKE_EXPORT_NO_PACKAGE_REGISTRY=TRUE") +try_compile(EXPORTER_COMPILED + ${FindPackageTest_BINARY_DIR}/Exporter-build + ${FindPackageTest_SOURCE_DIR}/Exporter + CMakeTestExportPackage dummy + CMAKE_FLAGS "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY:BOOL=TRUE" + -Dversion=${version} + OUTPUT_VARIABLE output) +message(STATUS "Searching for export(PACKAGE) test project") +find_package(CMakeTestExportPackage 1.${version} EXACT QUIET) +if(CMakeTestExportPackage_FOUND) + message(SEND_ERROR "CMakeTestExportPackage should not be FOUND!") +endif() + #----------------------------------------------------------------------------- # Test configure_package_config_file(). |