diff options
author | Brad King <brad.king@kitware.com> | 2014-08-11 13:54:08 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-08-11 13:54:08 (GMT) |
commit | 52584050c2bb0d65b60b0164af6a28c2761d1598 (patch) | |
tree | c05493608f0307d9a5ddb30fc9f5be6dc00793b5 /Tests | |
parent | 3b0d634f70db6af5469e83bb7c14f687bfafda74 (diff) | |
parent | 704830ae1f7f6b620f2df00ba168c0f3b060c6e2 (diff) | |
download | CMake-52584050c2bb0d65b60b0164af6a28c2761d1598.zip CMake-52584050c2bb0d65b60b0164af6a28c2761d1598.tar.gz CMake-52584050c2bb0d65b60b0164af6a28c2761d1598.tar.bz2 |
Merge topic 'CMakePackageConfigHelpers-INSTALL_PREFIX'
704830ae Help: Add notes for topic 'CMakePackageConfigHelpers-INSTALL_PREFIX'
e3007c92 CMakePackageConfigHelpers: Add unit tests for INSTALL_PREFIX option
d057bf85 CMakePackageConfigHelpers: Add INSTALL_PREFIX option
f3dd116c CMakePackageConfigHelpers: restructure documentation and document commands
64eca30d CMakePackageConfigHelpers: Remove unused variable
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(). |