diff options
author | Daniele E. Domenichelli <daniele.domenichelli@iit.it> | 2014-07-15 17:51:16 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-08-11 13:38:29 (GMT) |
commit | e3007c92e04416d7fba2db5de757c27d22d4af6b (patch) | |
tree | e8fdb9b38915315d28cd8e7c9ae76c33d119c37b /Tests | |
parent | d057bf85a6412bf79a1730b31338c4581e7940be (diff) | |
download | CMake-e3007c92e04416d7fba2db5de757c27d22d4af6b.zip CMake-e3007c92e04416d7fba2db5de757c27d22d4af6b.tar.gz CMake-e3007c92e04416d7fba2db5de757c27d22d4af6b.tar.bz2 |
CMakePackageConfigHelpers: Add unit tests for INSTALL_PREFIX option
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/FindPackageTest/CMakeLists.txt | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 092bf20..f311fb9 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -374,6 +374,7 @@ endif() include(CMakePackageConfigHelpers) +# Generate a config file ready to be installed. set(INCLUDE_INSTALL_DIR include ) set(SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/" ) set(CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" ) @@ -407,6 +408,43 @@ if(Relocatable_FOUND) message(SEND_ERROR "Relocatable_FOUND set to TRUE !") endif() +# Generate a config file for the build tree. +set(INCLUDE_INSTALL_DIR include ) +set(SHARE_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/share/" ) +set(CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" ) + +configure_package_config_file(RelocatableConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake" + INSTALL_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" + PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR + INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}" + ) + +set(Relocatable_FIND_COMPONENTS AComp BComp CComp) +set(Relocatable_FIND_REQUIRED_BComp 1) +include("${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake") + +if(NOT "${RELOC_INCLUDE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/include") + message(SEND_ERROR "RELOC_INCLUDE_DIR set by configure_package_config_file() is set to \"${RELOC_INCLUDE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/include\")") +endif() + +if(NOT "${RELOC_SHARE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/share/") + message(SEND_ERROR "RELOC_SHARE_DIR set by configure_package_config_file() is set to \"${RELOC_SHARE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/share/\")") +endif() + +if(NOT "${RELOC_BUILD_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") + message(SEND_ERROR "RELOC_BUILD_DIR set by configure_package_config_file() is set to \"${RELOC_BUILD_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}\")") +endif() + +if(NOT DEFINED Relocatable_FOUND) + message(SEND_ERROR "Relocatable_FOUND not defined !") +endif() + +if(Relocatable_FOUND) + message(SEND_ERROR "Relocatable_FOUND set to TRUE !") +endif() + + + #----------------------------------------------------------------------------- # Test write_basic_config_version_file(). |