summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-03-08 20:14:12 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-03-08 20:14:12 (GMT)
commitda43d8fa8d96f5bb4363b3fd093af97c8735c432 (patch)
tree0818855b0181f49a02ddbe5697410de0fda1a2b5 /Tests
parentf55119e63b4063daf6c8cdce5eb5415d04b0c2bd (diff)
parent6973e2d5a8be4d19aeb26fa67c0ed501ed81364e (diff)
downloadCMake-da43d8fa8d96f5bb4363b3fd093af97c8735c432.zip
CMake-da43d8fa8d96f5bb4363b3fd093af97c8735c432.tar.gz
CMake-da43d8fa8d96f5bb4363b3fd093af97c8735c432.tar.bz2
Merge topic 'MakingConfigFilesEasier_ConfigureMacro'
6973e2d wrap write_basic_config_version_file as write_basic_package_version_file() 204f5d4 add CMakePackageConfigHelpers: configure_package_config_file()
Diffstat (limited to 'Tests')
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt37
-rw-r--r--Tests/FindPackageTest/RelocatableConfig.cmake.in5
2 files changed, 37 insertions, 5 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index 9a4bdfe..a4f213b 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -305,13 +305,39 @@ STRING(REGEX REPLACE "-.*$" "" version ${CMAKE_VERSION})
FIND_PACKAGE(CMakeTestExportPackage 1.${version} EXACT REQUIRED)
#-----------------------------------------------------------------------------
-# Test write_basic_config_version_file().
+# Test configure_package_config_file().
-include(WriteBasicConfigVersionFile)
+include(CMakePackageConfigHelpers)
-write_basic_config_version_file(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake
- VERSION 1.2.3
- COMPATIBILITY AnyNewerVersion)
+set(INCLUDE_INSTALL_DIR include )
+set(SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/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_INSTALL_PREFIX}"
+ PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR
+ )
+
+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()
+
+#-----------------------------------------------------------------------------
+# Test write_basic_config_version_file().
+
+write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake
+ VERSION 1.2.3
+ COMPATIBILITY AnyNewerVersion)
set(PACKAGE_FIND_VERSION 2.3.4)
include(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake)
@@ -345,6 +371,7 @@ endif()
#######################
+include(WriteBasicConfigVersionFile)
write_basic_config_version_file(${CMAKE_CURRENT_BINARY_DIR}/Boo123ConfigVersion.cmake
VERSION 1.2.3
diff --git a/Tests/FindPackageTest/RelocatableConfig.cmake.in b/Tests/FindPackageTest/RelocatableConfig.cmake.in
new file mode 100644
index 0000000..7a34b2f
--- /dev/null
+++ b/Tests/FindPackageTest/RelocatableConfig.cmake.in
@@ -0,0 +1,5 @@
+@PACKAGE_INIT@
+
+set(RELOC_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
+set(RELOC_SHARE_DIR "@PACKAGE_SHARE_INSTALL_DIR@")
+set_and_check(RELOC_BUILD_DIR "@PACKAGE_CURRENT_BUILD_DIR@")