summaryrefslogtreecommitdiff
path: root/Tests/FindPackageTest
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-10-30 15:39:57 -0700
committerAnas Nashif <anas.nashif@intel.com>2012-10-30 15:39:57 -0700
commit035c7fabc3b82cbc9a346c11abe2e9462b4c0379 (patch)
tree7e40f5a790eae329a8c5d3e59f046451767956ff /Tests/FindPackageTest
downloadcmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.tar.gz
cmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.tar.bz2
cmake-035c7fabc3b82cbc9a346c11abe2e9462b4c0379.zip
Imported Upstream version 2.8.9upstream/2.8.9
Diffstat (limited to 'Tests/FindPackageTest')
-rw-r--r--Tests/FindPackageTest/A/wibble-config.cmake1
-rw-r--r--Tests/FindPackageTest/B/wibble-config.cmake1
-rw-r--r--Tests/FindPackageTest/Baz 1.1/BazConfig.cmake1
-rw-r--r--Tests/FindPackageTest/Baz 1.1/BazConfigVersion.cmake8
-rw-r--r--Tests/FindPackageTest/Baz 1.2/CMake/BazConfig.cmake1
-rw-r--r--Tests/FindPackageTest/Baz 1.2/CMake/BazConfigVersion.cmake8
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt533
-rw-r--r--Tests/FindPackageTest/Exporter/CMakeLists.txt12
-rw-r--r--Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfig.cmake.in1
-rw-r--r--Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in6
-rw-r--r--Tests/FindPackageTest/Exporter/dummy.c1
-rw-r--r--Tests/FindPackageTest/FindLotsOfComponents.cmake10
-rw-r--r--Tests/FindPackageTest/FindPackageHandleStandardArgs.cmake1
-rw-r--r--Tests/FindPackageTest/FindPackageTest.cxx4
-rw-r--r--Tests/FindPackageTest/FindRecursiveA.cmake1
-rw-r--r--Tests/FindPackageTest/FindRecursiveB.cmake1
-rw-r--r--Tests/FindPackageTest/FindRecursiveC.cmake1
-rw-r--r--Tests/FindPackageTest/FindVersionTestA.cmake18
-rw-r--r--Tests/FindPackageTest/FindVersionTestB.cmake18
-rw-r--r--Tests/FindPackageTest/FindVersionTestC.cmake18
-rw-r--r--Tests/FindPackageTest/FindVersionTestD.cmake18
-rw-r--r--Tests/FindPackageTest/RelocatableConfig.cmake.in11
-rw-r--r--Tests/FindPackageTest/SystemPackage/CMakeTestSystemPackageConfig.cmake1
-rw-r--r--Tests/FindPackageTest/TApp.app/Contents/Resources/TAppConfig.cmake1
-rw-r--r--Tests/FindPackageTest/TApp.app/Contents/Resources/cmake/tapp-config.cmake1
-rw-r--r--Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake1
-rw-r--r--Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/tframework-config.cmake1
-rw-r--r--Tests/FindPackageTest/cmake/SetFoundFALSEConfig.cmake1
-rw-r--r--Tests/FindPackageTest/cmake/SetFoundTRUEConfig.cmake1
-rw-r--r--Tests/FindPackageTest/include/foo.h1
-rw-r--r--Tests/FindPackageTest/lib/Bar/BarConfig.cmake1
-rw-r--r--Tests/FindPackageTest/lib/Bar/cmake/bar-config.cmake1
-rw-r--r--Tests/FindPackageTest/lib/Blub/BlubConfig.cmake1
-rw-r--r--Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake4
-rw-r--r--Tests/FindPackageTest/lib/TApp/TAppConfig.cmake2
-rw-r--r--Tests/FindPackageTest/lib/arch/Bar/BarConfig.cmake1
-rw-r--r--Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config-version.cmake7
-rw-r--r--Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config.cmake1
-rw-r--r--Tests/FindPackageTest/lib/arch/foo-1.2/CMake/FooConfig.cmake1
-rw-r--r--Tests/FindPackageTest/lib/arch/zot-3.1/zot-config-version.cmake7
-rw-r--r--Tests/FindPackageTest/lib/arch/zot-3.1/zot-config.cmake1
-rw-r--r--Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config-version.cmake4
-rw-r--r--Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config.cmake2
-rw-r--r--Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake8
-rw-r--r--Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config.cmake1
-rw-r--r--Tests/FindPackageTest/lib/foo-1.2/CMake/FooConfig.cmake1
-rw-r--r--Tests/FindPackageTest/lib/foo-1.2/foo-config.cmake1
-rw-r--r--Tests/FindPackageTest/lib/suffix/test/SuffixTestConfig.cmake1
-rw-r--r--Tests/FindPackageTest/lib/suffix/test/SuffixTestConfigVersion.cmake7
-rw-r--r--Tests/FindPackageTest/lib/zot-1.0/zot-config.cmake1
-rw-r--r--Tests/FindPackageTest/lib/zot-2.0/zot-config-version.cmake5
-rw-r--r--Tests/FindPackageTest/lib/zot-2.0/zot-config.cmake1
-rw-r--r--Tests/FindPackageTest/lib/zot-3.0/zot-config-version.cmake5
-rw-r--r--Tests/FindPackageTest/lib/zot-3.0/zot-config.cmake1
-rw-r--r--Tests/FindPackageTest/lib/zot-3.1/zot-config-version.cmake8
-rw-r--r--Tests/FindPackageTest/lib/zot-3.1/zot-config.cmake1
-rw-r--r--Tests/FindPackageTest/lib/zot/zot-config-version.cmake10
-rw-r--r--Tests/FindPackageTest/lib/zot/zot-config.cmake2
58 files changed, 768 insertions, 0 deletions
diff --git a/Tests/FindPackageTest/A/wibble-config.cmake b/Tests/FindPackageTest/A/wibble-config.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/A/wibble-config.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/B/wibble-config.cmake b/Tests/FindPackageTest/B/wibble-config.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/B/wibble-config.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/Baz 1.1/BazConfig.cmake b/Tests/FindPackageTest/Baz 1.1/BazConfig.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/Baz 1.1/BazConfig.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/Baz 1.1/BazConfigVersion.cmake b/Tests/FindPackageTest/Baz 1.1/BazConfigVersion.cmake
new file mode 100644
index 000000000..321fa118e
--- /dev/null
+++ b/Tests/FindPackageTest/Baz 1.1/BazConfigVersion.cmake
@@ -0,0 +1,8 @@
+SET(PACKAGE_VERSION 1.1)
+IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1)
+ SET(PACKAGE_VERSION_COMPATIBLE 1)
+ IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1)
+ SET(PACKAGE_VERSION_EXACT 1)
+ ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1)
+ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1)
+
diff --git a/Tests/FindPackageTest/Baz 1.2/CMake/BazConfig.cmake b/Tests/FindPackageTest/Baz 1.2/CMake/BazConfig.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/Baz 1.2/CMake/BazConfig.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/Baz 1.2/CMake/BazConfigVersion.cmake b/Tests/FindPackageTest/Baz 1.2/CMake/BazConfigVersion.cmake
new file mode 100644
index 000000000..4576809f5
--- /dev/null
+++ b/Tests/FindPackageTest/Baz 1.2/CMake/BazConfigVersion.cmake
@@ -0,0 +1,8 @@
+SET(PACKAGE_VERSION 1.2)
+IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1)
+ SET(PACKAGE_VERSION_COMPATIBLE 1)
+ IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 2)
+ SET(PACKAGE_VERSION_EXACT 1)
+ ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 2)
+ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1)
+
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
new file mode 100644
index 000000000..e85fb4dd2
--- /dev/null
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -0,0 +1,533 @@
+cmake_minimum_required (VERSION 2.6)
+PROJECT(FindPackageTest)
+
+LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+
+# Look for a package which uses FindPackageHandleStandardArgs.cmake with the
+# new (as of cmake 2.8.3) syntax. This works only if CMP0017 is set to NEW,
+# because otherwise FindPackageHandleStandardArgs.cmake from the current
+# directory is included (via CMAKE_MODULE_PATH).
+CMAKE_POLICY(SET CMP0017 NEW)
+FIND_PACKAGE(ZLIB QUIET)
+
+# Look for a package that has a find module and may be found.
+FIND_PACKAGE(OpenGL QUIET)
+
+# Look for a package that has no find module and will not be found.
+FIND_PACKAGE(NotAPackage QUIET)
+
+# Look for a package that has an advanced find module.
+FIND_PACKAGE(VTK QUIET)
+
+ADD_EXECUTABLE(FindPackageTest FindPackageTest.cxx)
+
+# test behaviour of cmFindBase wrt. the CMAKE_PREFIX_PATH variable
+# foo.h should be found in ${CMAKE_CURRENT_SOURCE_DIR}/include:
+
+SET(CMAKE_PREFIX_PATH /blub /blah "${CMAKE_CURRENT_SOURCE_DIR}")
+FIND_PATH(FOO_DIR foo.h)
+
+IF(NOT FOO_DIR)
+ MESSAGE(FATAL_ERROR "Did not find foo.h which is in ${CMAKE_CURRENT_SOURCE_DIR}/include
+ CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}")
+ENDIF(NOT FOO_DIR)
+
+FIND_PACKAGE(VersionTestA 1)
+FIND_PACKAGE(VersionTestB 1.2)
+FIND_PACKAGE(VersionTestC 1.2.3)
+FIND_PACKAGE(VersionTestD 1.2.3.4)
+
+
+FIND_PACKAGE(LotsOfComponents COMPONENTS AComp OPTIONAL_COMPONENTS BComp CComp)
+IF(NOT LOTSOFCOMPONENTS_FOUND)
+ MESSAGE(SEND_ERROR "LotsOfComponents not found !")
+ENDIF()
+
+#-----------------------------------------------------------------------------
+# Test system package registry if possible.
+SET(CMakeTestSystemPackage "")
+IF(WIN32 AND NOT CYGWIN)
+ # Try writing a value to the system package registry.
+ SET(_data "${FindPackageTest_SOURCE_DIR}/SystemPackage")
+ SET(_key "HKLM\\Software\\Kitware\\CMake\\Packages\\CMakeTestSystemPackage")
+ SET(_file "${FindPackageTest_BINARY_DIR}/CMakeTestSystemPackage.data")
+ FILE(WRITE ${_file} "${_data}\n")
+ EXECUTE_PROCESS(
+ COMMAND ${CMAKE_COMMAND} -E md5sum ${_file}
+ OUTPUT_VARIABLE _output ERROR_VARIABLE _error RESULT_VARIABLE _failed
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ STRING(REGEX REPLACE " .*" "" _value "${_output}")
+ IF(NOT _failed AND _value)
+ EXECUTE_PROCESS(
+ COMMAND reg add "${_key}" /v "${_value}" /t REG_SZ /d "${_data}" /f
+ OUTPUT_VARIABLE _output ERROR_VARIABLE _output RESULT_VARIABLE _failed
+ )
+ ENDIF()
+ # If the above worked, add the rest of the test and a rule to
+ # cleanup the value.
+ IF(NOT _failed)
+ MESSAGE(STATUS "HKLM is writable: enabling CMakeTestSystemPackage")
+ SET(CMakeTestSystemPackage_CLEANUP reg delete "${_key}" /v "${_value}" /f)
+ SET(CMakeTestSystemPackage CMakeTestSystemPackage)
+ ELSE()
+ MESSAGE(STATUS "HKLM is readonly: disabling CMakeTestSystemPackage")
+ ENDIF()
+ENDIF()
+
+#-----------------------------------------------------------------------------
+
+#SET(CMAKE_FIND_DEBUG_MODE 1)
+
+# For purposes of the test wipe out previous find results.
+SET(PACKAGES
+ foo Foo Bar Blub TFramework Tframework TApp Tapp Special
+ VersionedA VersionedB VersionedC VersionedD VersionedE
+ WrongA WrongB WrongC WrongD
+ wibbleA wibbleB
+ RecursiveA RecursiveB RecursiveC
+ ArchA ArchB ArchC ArchD
+ EnvA EnvB
+ SetFoundTRUE SetFoundFALSE
+ ${CMakeTestSystemPackage}
+ )
+FOREACH(p ${PACKAGES})
+ SET(${p}_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+ENDFOREACH(p)
+
+# Enable framework and bundle searching. Make sure bundles are found
+# before unix-syle packages.
+SET(CMAKE_FIND_FRAMEWORK LAST)
+SET(CMAKE_FIND_APPBUNDLE FIRST)
+
+# Set the wrong answer for a find to make sure it re-finds.
+set(VersionedA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/cmake/zot-4.0)
+
+# Test that CMAKE_IGNORE_PATH can ignore the purposely bad package
+# files in the lib/cmake/zot-3.1 directory.
+set(CMAKE_IGNORE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib/cmake/zot-3.1)
+
+# Look for packages with new-style signatures.
+FIND_PACKAGE(foo NO_MODULE)
+FIND_PACKAGE(Foo CONFIGS FooConfig.cmake)
+FIND_PACKAGE(Bar)
+SET(CMAKE_DISABLE_FIND_PACKAGE_Blub TRUE)
+FIND_PACKAGE(Blub NO_MODULE)
+FIND_PACKAGE(TFramework CONFIGS TFrameworkConfig.cmake)
+FIND_PACKAGE(Tframework)
+FIND_PACKAGE(TApp)
+FIND_PACKAGE(Tapp CONFIGS tapp-config.cmake)
+FIND_PACKAGE(Special NAMES Suffix SuffixTest PATH_SUFFIXES test)
+FIND_PACKAGE(VersionedA 2 NAMES zot)
+FIND_PACKAGE(VersionedB 3.1 EXACT NAMES zot)
+FIND_PACKAGE(VersionedC 4.0 EXACT NAMES zot)
+FIND_PACKAGE(VersionedD 1.1 EXACT NAMES Baz)
+FIND_PACKAGE(VersionedE 1.2 EXACT NAMES Baz)
+
+# Test Config files which set Xyz_FOUND themselves:
+FIND_PACKAGE(SetFoundTRUE NO_MODULE)
+FIND_PACKAGE(SetFoundFALSE NO_MODULE)
+
+# Test wrong initial path when result is present.
+SET(WrongA_DIR "${VersionedD_DIR}")
+FIND_PACKAGE(WrongA 1.2 EXACT NAMES Baz)
+
+# Test wrong initial cache entry of UNINITIALIZED type when result is present.
+SET(WrongB_DIR "${VersionedD_DIR}" CACHE UNINITIALIZED "Wrong Value" FORCE)
+GET_PROPERTY(type CACHE WrongB_DIR PROPERTY TYPE)
+FIND_PACKAGE(WrongB 1.2 EXACT NAMES Baz)
+
+# Test wrong initial path when result is missing.
+SET(WrongC_DIR "${VersionedD_DIR}")
+FIND_PACKAGE(WrongC 1.3 EXACT QUIET NAMES Baz)
+
+# Test wrong initial cache entry of UNINITIALIZED type when result is missing.
+SET(WrongD_DIR "${VersionedD_DIR}" CACHE UNINITIALIZED "Wrong Value" FORCE)
+GET_PROPERTY(type CACHE WrongD_DIR PROPERTY TYPE)
+FIND_PACKAGE(WrongD 1.3 EXACT QUIET NAMES Baz)
+
+# HINTS should override the system but PATHS should not
+LIST(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/A")
+FIND_PACKAGE(wibbleA NAMES wibble PATHS B)
+FIND_PACKAGE(wibbleB NAMES wibble HINTS B)
+
+# Look for package with recursive find-modules.
+FIND_PACKAGE(RecursiveA COMPONENTS A)
+FIND_PACKAGE(RecursiveB 2)
+FIND_PACKAGE(RecursiveC 3.1 EXACT)
+
+# Test architecture-specific search directories.
+SET(CMAKE_LIBRARY_ARCHITECTURE arch)
+FIND_PACKAGE(ArchA NAMES Bar)
+FIND_PACKAGE(ArchB NAMES Foo CONFIGS FooConfig.cmake)
+FIND_PACKAGE(ArchC 3.1 EXACT NAMES zot)
+FIND_PACKAGE(ArchD 4.0 EXACT NAMES zot)
+UNSET(CMAKE_LIBRARY_ARCHITECTURE)
+
+# Test <Package>_DIR environment variable.
+# We erase the main prefix path to ensure the env var is used.
+SET(CMAKE_PREFIX_PATH)
+SET(ENV{EnvA_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/lib/zot-3.1")
+FIND_PACKAGE(EnvA 3.1 EXACT QUIET NAMES zot) # Should Work
+FIND_PACKAGE(EnvB 3.1 EXACT QUIET NAMES zot) # Should Fail
+
+# Test system package registry if available.
+IF(CMakeTestSystemPackage)
+ FIND_PACKAGE(CMakeTestSystemPackage)
+ EXECUTE_PROCESS(COMMAND ${CMakeTestSystemPackage_CLEANUP}
+ OUTPUT_VARIABLE _output ERROR_VARIABLE _error)
+ENDIF()
+
+# Expected locations at which packages should be found.
+SET(foo_EXPECTED "lib/foo-1.2/foo-config.cmake")
+SET(Foo_EXPECTED "lib/foo-1.2/CMake/FooConfig.cmake")
+SET(Bar_EXPECTED "lib/Bar/BarConfig.cmake")
+SET(Blub_MISSING "")
+SET(Special_EXPECTED "lib/suffix/test/SuffixTestConfig.cmake")
+SET(TFramework_EXPECTED
+ "TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake")
+SET(Tframework_EXPECTED
+ "TFramework.framework/Versions/A/Resources/tframework-config.cmake")
+SET(TApp_EXPECTED
+ "TApp.app/Contents/Resources/TAppConfig.cmake")
+SET(Tapp_EXPECTED
+ "TApp.app/Contents/Resources/cmake/tapp-config.cmake")
+SET(VersionedA_EXPECTED "lib/zot-2.0/zot-config.cmake")
+SET(VersionedB_EXPECTED "lib/zot-3.1/zot-config.cmake")
+SET(VersionedC_EXPECTED "lib/cmake/zot-4.0/zot-config.cmake")
+SET(VersionedD_EXPECTED "Baz 1.1/BazConfig.cmake")
+SET(VersionedE_EXPECTED "Baz 1.2/CMake/BazConfig.cmake")
+SET(WrongA_EXPECTED "${VersionedE_EXPECTED}")
+SET(WrongB_EXPECTED "${VersionedE_EXPECTED}")
+SET(WrongC_MISSING "WrongC_DIR-NOTFOUND")
+SET(WrongD_MISSING "WrongD_DIR-NOTFOUND")
+SET(wibbleA_EXPECTED "A/wibble-config.cmake")
+SET(wibbleB_EXPECTED "B/wibble-config.cmake")
+SET(RecursiveA_EXPECTED "lib/RecursiveA/recursivea-config.cmake")
+SET(RecursiveB_EXPECTED "lib/zot-2.0/zot-config.cmake")
+SET(RecursiveC_EXPECTED "lib/zot-3.1/zot-config.cmake")
+SET(ArchA_EXPECTED "lib/arch/Bar/BarConfig.cmake")
+SET(ArchB_EXPECTED "lib/arch/foo-1.2/CMake/FooConfig.cmake")
+SET(ArchC_EXPECTED "lib/arch/zot-3.1/zot-config.cmake")
+SET(ArchD_EXPECTED "lib/arch/cmake/zot-4.0/zot-config.cmake")
+SET(EnvA_EXPECTED "lib/zot-3.1/zot-config.cmake")
+SET(EnvB_MISSING "EnvB_DIR-NOTFOUND")
+SET(SetFoundTRUE_EXPECTED "cmake/SetFoundTRUEConfig.cmake")
+SET(SetFoundFALSE_MISSING "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+SET(CMakeTestSystemPackage_EXPECTED "SystemPackage/CMakeTestSystemPackageConfig.cmake")
+
+# Check the results.
+FOREACH(p ${PACKAGES})
+ IF(DEFINED ${p}_MISSING)
+ # Check and report failure.
+ IF(NOT "${${p}_DIR}" STREQUAL "${${p}_MISSING}")
+ MESSAGE(SEND_ERROR
+ "Package ${p} should have been [${${p}_MISSING}] but "
+ "was [${${p}_DIR}]")
+ ENDIF()
+ IF(${p}_FOUND)
+ MESSAGE(SEND_ERROR
+ "Package ${p} should not have been found, but ${p}_FOUND is set to "
+ "\"${${p}_FOUND}\"")
+ ENDIF()
+ ELSEIF(${p}_FOUND)
+ # Convert to relative path for comparison to expected location.
+ FILE(RELATIVE_PATH REL_${p}_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}"
+ "${${p}_CONFIG}")
+
+ # Debugging output.
+ IF(CMAKE_FIND_DEBUG_MODE)
+ MESSAGE("Package ${p} found [${REL_${p}_CONFIG}]")
+ ENDIF(CMAKE_FIND_DEBUG_MODE)
+
+ # Check and report failure.
+ IF(NOT "${REL_${p}_CONFIG}" STREQUAL "${${p}_EXPECTED}")
+ MESSAGE(SEND_ERROR
+ "Package ${p} should have been [${${p}_EXPECTED}] but "
+ "was [${REL_${p}_CONFIG}]")
+ ENDIF(NOT "${REL_${p}_CONFIG}" STREQUAL "${${p}_EXPECTED}")
+ ELSE()
+ MESSAGE(SEND_ERROR "Package ${p} not found!")
+ ENDIF()
+ENDFOREACH(p)
+
+# Check that version information was extracted.
+IF(NOT "${VersionedA_VERSION}" STREQUAL "2.0")
+ MESSAGE(SEND_ERROR
+ "Package VersionedA is version [${VersionedA_VERSION}], not [2.0]")
+ENDIF(NOT "${VersionedA_VERSION}" STREQUAL "2.0")
+IF(NOT "${VersionedA_VERSION_MAJOR}" STREQUAL "2")
+ MESSAGE(SEND_ERROR
+ "Package VersionedA is major version [${VersionedA_VERSION_MAJOR}], not [2]")
+ENDIF(NOT "${VersionedA_VERSION_MAJOR}" STREQUAL "2")
+IF(NOT "${VersionedA_VERSION_MINOR}" STREQUAL "0")
+ MESSAGE(SEND_ERROR
+ "Package VersionedA is minor version [${VersionedA_VERSION_MINOR}], not [0]")
+ENDIF(NOT "${VersionedA_VERSION_MINOR}" STREQUAL "0")
+
+IF(NOT "${VersionedB_VERSION}" STREQUAL "3.1")
+ MESSAGE(SEND_ERROR
+ "Package VersionedB is version [${VersionedB_VERSION}], not [3.1]")
+ENDIF(NOT "${VersionedB_VERSION}" STREQUAL "3.1")
+IF(NOT "${VersionedB_VERSION_MAJOR}" STREQUAL "3")
+ MESSAGE(SEND_ERROR
+ "Package VersionedB is major version [${VersionedB_VERSION_MAJOR}], not [3]")
+ENDIF(NOT "${VersionedB_VERSION_MAJOR}" STREQUAL "3")
+IF(NOT "${VersionedB_VERSION_MINOR}" STREQUAL "1")
+ MESSAGE(SEND_ERROR
+ "Package VersionedB is minor version [${VersionedB_VERSION_MINOR}], not [1]")
+ENDIF(NOT "${VersionedB_VERSION_MINOR}" STREQUAL "1")
+
+IF(NOT "${Special_VERSION}" STREQUAL "1.2")
+ MESSAGE(SEND_ERROR
+ "Package Special is version [${Special_VERSION}], not [1.2]")
+ENDIF(NOT "${Special_VERSION}" STREQUAL "1.2")
+IF(NOT "${Special_VERSION_MAJOR}" STREQUAL "1")
+ MESSAGE(SEND_ERROR
+ "Package Special is major version [${Special_VERSION_MAJOR}], not [1]")
+ENDIF(NOT "${Special_VERSION_MAJOR}" STREQUAL "1")
+IF(NOT "${Special_VERSION_MINOR}" STREQUAL "2")
+ MESSAGE(SEND_ERROR
+ "Package Special is minor version [${Special_VERSION_MINOR}], not [2]")
+ENDIF(NOT "${Special_VERSION_MINOR}" STREQUAL "2")
+
+# Test version number comparison.
+IF(NOT "1.2.3.4" VERSION_LESS "1.2.3.5")
+ MESSAGE(SEND_ERROR "1.2.3.4 VERSION_LESS 1.2.3.5 is not true!")
+ENDIF()
+IF(NOT "1.2" VERSION_LESS "1.10")
+ MESSAGE(SEND_ERROR "1.2 VERSION_LESS 1.10 is not true!")
+ENDIF()
+IF(NOT "1.02" VERSION_GREATER "1.1")
+ MESSAGE(SEND_ERROR "1.02 VERSION_GREATER 1.1 is not true!")
+ENDIF()
+IF("1.2.3" VERSION_GREATER "1.2.3.4")
+ MESSAGE(SEND_ERROR "1.2.3 VERSION_GREATER 1.2.3.4 is not false!")
+ENDIF()
+IF(NOT "1.2" VERSION_EQUAL "1.2.0.0")
+ MESSAGE(SEND_ERROR "1.2 VERSION_EQUAL 1.2.0.0 is not true!")
+ENDIF()
+
+#-----------------------------------------------------------------------------
+# Test export(PACKAGE) with find_package.
+MESSAGE(STATUS "Preparing export(PACKAGE) test project")
+TRY_COMPILE(EXPORTER_COMPILED
+ ${FindPackageTest_BINARY_DIR}/Exporter
+ ${FindPackageTest_SOURCE_DIR}/Exporter
+ CMakeTestExportPackage dummy
+ OUTPUT_VARIABLE output)
+MESSAGE(STATUS "Searching for export(PACKAGE) test project")
+SET(CMakeTestExportPackage_DIR "" CACHE FILEPATH
+ "Wipe out find results for testing." FORCE)
+STRING(REGEX REPLACE "-.*$" "" version ${CMAKE_VERSION})
+FIND_PACKAGE(CMakeTestExportPackage 1.${version} EXACT REQUIRED)
+
+#-----------------------------------------------------------------------------
+# Test configure_package_config_file().
+
+include(CMakePackageConfigHelpers)
+
+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
+ )
+
+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().
+
+# also test that an empty CMAKE_SIZEOF_VOID_P is accepted:
+set(_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
+set(CMAKE_SIZEOF_VOID_P "")
+
+write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake
+ VERSION 1.2.3
+ COMPATIBILITY AnyNewerVersion)
+
+set(CMAKE_SIZEOF_VOID_P ${_CMAKE_SIZEOF_VOID_P})
+
+set(PACKAGE_FIND_VERSION 2.3.4)
+include(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake)
+if(PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Found Foo123 with version 1.2.3, but 2.3.4 was requested !")
+endif()
+
+set(PACKAGE_FIND_VERSION 0.0.1)
+include(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake)
+if(NOT PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Did not find Foo123 with version 1.2.3 (0.0.1 was requested) !")
+endif()
+
+if(PACKAGE_VERSION_UNSUITABLE)
+ message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE set, but must not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 1.0.0)
+include(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake)
+if(NOT PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Did not find Foo123 with version 1.2.3 (1.0.0 was requested) !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 1.2.3)
+include(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake)
+if(NOT PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Did not find Foo123 with version 1.2.3 (1.2.3 was requested) !")
+endif()
+if(NOT PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT not set, although it should be !")
+endif()
+
+
+#######################
+include(WriteBasicConfigVersionFile)
+
+write_basic_config_version_file(${CMAKE_CURRENT_BINARY_DIR}/Boo123ConfigVersion.cmake
+ VERSION 1.2.3
+ COMPATIBILITY SameMajorVersion)
+
+unset(PACKAGE_VERSION_UNSUITABLE)
+set(PACKAGE_VERSION_EXACT FALSE)
+set(PACKAGE_FIND_VERSION 2.3.4)
+set(PACKAGE_FIND_VERSION_MAJOR 2)
+include(${CMAKE_CURRENT_BINARY_DIR}/Boo123ConfigVersion.cmake)
+if(PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Found Boo123 with version 1.2.3, but 2.3.4 was requested !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 0.0.1)
+set(PACKAGE_FIND_VERSION_MAJOR 0)
+include(${CMAKE_CURRENT_BINARY_DIR}/Boo123ConfigVersion.cmake)
+if(PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Found Boo123 with version 1.2.3, but 0.0.1 was requested !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 1.0.0)
+set(PACKAGE_FIND_VERSION_MAJOR 1)
+include(${CMAKE_CURRENT_BINARY_DIR}/Boo123ConfigVersion.cmake)
+if(NOT PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Did not find Boo123 with version 1.2.3 (1.0.0 was requested) !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 1.2.3)
+set(PACKAGE_FIND_VERSION_MAJOR 1)
+include(${CMAKE_CURRENT_BINARY_DIR}/Boo123ConfigVersion.cmake)
+if(NOT PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Did not find Boo123 with version 1.2.3 (1.2.3 was requested) !")
+endif()
+if(NOT PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT not set, although it should be !")
+endif()
+
+if(PACKAGE_VERSION_UNSUITABLE)
+ message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE set, but must not be !")
+endif()
+
+#######################
+
+write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake
+ VERSION 1.2.3.17
+ COMPATIBILITY ExactVersion)
+
+unset(PACKAGE_VERSION_UNSUITABLE)
+set(PACKAGE_VERSION_EXACT FALSE)
+set(PACKAGE_FIND_VERSION 2.3.4)
+include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
+if(PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Found Bar123 with version 1.2.3 (2.3.4 was requested) !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 1.2)
+include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
+if(PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Found Bar123 with version 1.2.3 (1.2 was requested) !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 1)
+include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
+if(PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Found Bar123 with version 1.2.3 (1 was requested) !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 1.2.3.4)
+include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
+if(NOT PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3.4 was requested) !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 1.2.3)
+set(PACKAGE_VERSION_EXACT FALSE)
+set(PACKAGE_VERSION_COMPATIBLE FALSE)
+include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
+if(NOT PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3 was requested) !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+
+set(PACKAGE_FIND_VERSION 1.2.3.17)
+set(PACKAGE_VERSION_EXACT FALSE)
+set(PACKAGE_VERSION_COMPATIBLE FALSE)
+include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
+if(NOT PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3.17 was requested) !")
+endif()
+if(NOT PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT not set, although it should be !")
+endif()
+
+if(PACKAGE_VERSION_UNSUITABLE)
+ message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE set, but must not be !")
+endif()
diff --git a/Tests/FindPackageTest/Exporter/CMakeLists.txt b/Tests/FindPackageTest/Exporter/CMakeLists.txt
new file mode 100644
index 000000000..d25a2e74c
--- /dev/null
+++ b/Tests/FindPackageTest/Exporter/CMakeLists.txt
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 2.7.20090831)
+project(CMakeTestExportPackage C)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeTestExportPackageConfig.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeTestExportPackageConfig.cmake
+ @ONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeTestExportPackageConfigVersion.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/CMakeTestExportPackageConfigVersion.cmake
+ @ONLY)
+export(PACKAGE CMakeTestExportPackage)
+
+add_executable(dummy dummy.c)
diff --git a/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfig.cmake.in b/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfig.cmake.in
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfig.cmake.in
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in b/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in
new file mode 100644
index 000000000..ff450a145
--- /dev/null
+++ b/Tests/FindPackageTest/Exporter/CMakeTestExportPackageConfigVersion.cmake.in
@@ -0,0 +1,6 @@
+# Test config file.
+SET(PACKAGE_VERSION "1.@CMAKE_VERSION@")
+IF("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "${PACKAGE_VERSION}")
+ SET(PACKAGE_VERSION_COMPATIBLE 1)
+ SET(PACKAGE_VERSION_EXACT 1)
+ENDIF()
diff --git a/Tests/FindPackageTest/Exporter/dummy.c b/Tests/FindPackageTest/Exporter/dummy.c
new file mode 100644
index 000000000..76e819701
--- /dev/null
+++ b/Tests/FindPackageTest/Exporter/dummy.c
@@ -0,0 +1 @@
+int main() { return 0; }
diff --git a/Tests/FindPackageTest/FindLotsOfComponents.cmake b/Tests/FindPackageTest/FindLotsOfComponents.cmake
new file mode 100644
index 000000000..9076d86ed
--- /dev/null
+++ b/Tests/FindPackageTest/FindLotsOfComponents.cmake
@@ -0,0 +1,10 @@
+set(LOC_FOO TRUE)
+
+set(LotsOfComponents_AComp_FOUND TRUE)
+set(LotsOfComponents_BComp_FOUND FALSE)
+set(LotsOfComponents_CComp_FOUND TRUE)
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(LotsOfComponents REQUIRED_VARS LOC_FOO
+ HANDLE_COMPONENTS)
diff --git a/Tests/FindPackageTest/FindPackageHandleStandardArgs.cmake b/Tests/FindPackageTest/FindPackageHandleStandardArgs.cmake
new file mode 100644
index 000000000..7e41c96c9
--- /dev/null
+++ b/Tests/FindPackageTest/FindPackageHandleStandardArgs.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "This file (${CMAKE_CURRENT_LIST_FILE}) must not be included, but FindPackageHandleStandardArgs.cmake from Modules/ instead !")
diff --git a/Tests/FindPackageTest/FindPackageTest.cxx b/Tests/FindPackageTest/FindPackageTest.cxx
new file mode 100644
index 000000000..f8b643afb
--- /dev/null
+++ b/Tests/FindPackageTest/FindPackageTest.cxx
@@ -0,0 +1,4 @@
+int main()
+{
+ return 0;
+}
diff --git a/Tests/FindPackageTest/FindRecursiveA.cmake b/Tests/FindPackageTest/FindRecursiveA.cmake
new file mode 100644
index 000000000..3af7e99a3
--- /dev/null
+++ b/Tests/FindPackageTest/FindRecursiveA.cmake
@@ -0,0 +1 @@
+FIND_PACKAGE(RecursiveA NO_MODULE)
diff --git a/Tests/FindPackageTest/FindRecursiveB.cmake b/Tests/FindPackageTest/FindRecursiveB.cmake
new file mode 100644
index 000000000..c609ab127
--- /dev/null
+++ b/Tests/FindPackageTest/FindRecursiveB.cmake
@@ -0,0 +1 @@
+FIND_PACKAGE(RecursiveB NAMES zot)
diff --git a/Tests/FindPackageTest/FindRecursiveC.cmake b/Tests/FindPackageTest/FindRecursiveC.cmake
new file mode 100644
index 000000000..018cc7302
--- /dev/null
+++ b/Tests/FindPackageTest/FindRecursiveC.cmake
@@ -0,0 +1 @@
+FIND_PACKAGE(RecursiveC NAMES zot)
diff --git a/Tests/FindPackageTest/FindVersionTestA.cmake b/Tests/FindPackageTest/FindVersionTestA.cmake
new file mode 100644
index 000000000..55c67e257
--- /dev/null
+++ b/Tests/FindPackageTest/FindVersionTestA.cmake
@@ -0,0 +1,18 @@
+IF(NOT "${VersionTestA_FIND_VERSION}" STREQUAL "1")
+ MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION=${VersionTestA_FIND_VERSION} is not 1")
+ENDIF(NOT "${VersionTestA_FIND_VERSION}" STREQUAL "1")
+IF(NOT "${VersionTestA_FIND_VERSION_MAJOR}" STREQUAL "1")
+ MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION_MAJOR=${VersionTestA_FIND_VERSION_MAJOR} is not 1")
+ENDIF(NOT "${VersionTestA_FIND_VERSION_MAJOR}" STREQUAL "1")
+IF(NOT "${VersionTestA_FIND_VERSION_MINOR}" STREQUAL "0")
+ MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION_MINOR=${VersionTestA_FIND_VERSION_MINOR} is not 0")
+ENDIF(NOT "${VersionTestA_FIND_VERSION_MINOR}" STREQUAL "0")
+IF(NOT "${VersionTestA_FIND_VERSION_PATCH}" STREQUAL "0")
+ MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION_PATCH=${VersionTestA_FIND_VERSION_PATCH} is not 0")
+ENDIF(NOT "${VersionTestA_FIND_VERSION_PATCH}" STREQUAL "0")
+IF(NOT "${VersionTestA_FIND_VERSION_TWEAK}" STREQUAL "0")
+ MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION_TWEAK=${VersionTestA_FIND_VERSION_TWEAK} is not 0")
+ENDIF(NOT "${VersionTestA_FIND_VERSION_TWEAK}" STREQUAL "0")
+IF(NOT "${VersionTestA_FIND_VERSION_COUNT}" STREQUAL "1")
+ MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION_COUNT=${VersionTestA_FIND_VERSION_COUNT} is not 1")
+ENDIF(NOT "${VersionTestA_FIND_VERSION_COUNT}" STREQUAL "1")
diff --git a/Tests/FindPackageTest/FindVersionTestB.cmake b/Tests/FindPackageTest/FindVersionTestB.cmake
new file mode 100644
index 000000000..03173c65a
--- /dev/null
+++ b/Tests/FindPackageTest/FindVersionTestB.cmake
@@ -0,0 +1,18 @@
+IF(NOT "${VersionTestB_FIND_VERSION}" STREQUAL "1.2")
+ MESSAGE(SEND_ERROR "VersionTestB_FIND_VERSION=${VersionTestB_FIND_VERSION} is not 1.2")
+ENDIF(NOT "${VersionTestB_FIND_VERSION}" STREQUAL "1.2")
+IF(NOT "${VersionTestB_FIND_VERSION_MAJOR}" STREQUAL "1")
+ MESSAGE(SEND_ERROR "VersionTestB_FIND_VERSION_MAJOR=${VersionTestB_FIND_VERSION_MAJOR} is not 1")
+ENDIF(NOT "${VersionTestB_FIND_VERSION_MAJOR}" STREQUAL "1")
+IF(NOT "${VersionTestB_FIND_VERSION_MINOR}" STREQUAL "2")
+ MESSAGE(SEND_ERROR "VersionTestB_FIND_VERSION_MINOR=${VersionTestB_FIND_VERSION_MINOR} is not 2")
+ENDIF(NOT "${VersionTestB_FIND_VERSION_MINOR}" STREQUAL "2")
+IF(NOT "${VersionTestB_FIND_VERSION_PATCH}" STREQUAL "0")
+ MESSAGE(SEND_ERROR "VersionTestB_FIND_VERSION_PATCH=${VersionTestB_FIND_VERSION_PATCH} is not 0")
+ENDIF(NOT "${VersionTestB_FIND_VERSION_PATCH}" STREQUAL "0")
+IF(NOT "${VersionTestB_FIND_VERSION_TWEAK}" STREQUAL "0")
+ MESSAGE(SEND_ERROR "VersionTestB_FIND_VERSION_TWEAK=${VersionTestB_FIND_VERSION_TWEAK} is not 0")
+ENDIF(NOT "${VersionTestB_FIND_VERSION_TWEAK}" STREQUAL "0")
+IF(NOT "${VersionTestB_FIND_VERSION_COUNT}" STREQUAL "2")
+ MESSAGE(SEND_ERROR "VersionTestB_FIND_VERSION_COUNT=${VersionTestB_FIND_VERSION_COUNT} is not 2")
+ENDIF(NOT "${VersionTestB_FIND_VERSION_COUNT}" STREQUAL "2")
diff --git a/Tests/FindPackageTest/FindVersionTestC.cmake b/Tests/FindPackageTest/FindVersionTestC.cmake
new file mode 100644
index 000000000..1344cbc22
--- /dev/null
+++ b/Tests/FindPackageTest/FindVersionTestC.cmake
@@ -0,0 +1,18 @@
+IF(NOT "${VersionTestC_FIND_VERSION}" STREQUAL "1.2.3")
+ MESSAGE(SEND_ERROR "VersionTestC_FIND_VERSION=${VersionTestC_FIND_VERSION} is not 1.2.3")
+ENDIF(NOT "${VersionTestC_FIND_VERSION}" STREQUAL "1.2.3")
+IF(NOT "${VersionTestC_FIND_VERSION_MAJOR}" STREQUAL "1")
+ MESSAGE(SEND_ERROR "VersionTestC_FIND_VERSION_MAJOR=${VersionTestC_FIND_VERSION_MAJOR} is not 1")
+ENDIF(NOT "${VersionTestC_FIND_VERSION_MAJOR}" STREQUAL "1")
+IF(NOT "${VersionTestC_FIND_VERSION_MINOR}" STREQUAL "2")
+ MESSAGE(SEND_ERROR "VersionTestC_FIND_VERSION_MINOR=${VersionTestC_FIND_VERSION_MINOR} is not 2")
+ENDIF(NOT "${VersionTestC_FIND_VERSION_MINOR}" STREQUAL "2")
+IF(NOT "${VersionTestC_FIND_VERSION_PATCH}" STREQUAL "3")
+ MESSAGE(SEND_ERROR "VersionTestC_FIND_VERSION_PATCH=${VersionTestC_FIND_VERSION_PATCH} is not 3")
+ENDIF(NOT "${VersionTestC_FIND_VERSION_PATCH}" STREQUAL "3")
+IF(NOT "${VersionTestC_FIND_VERSION_TWEAK}" STREQUAL "0")
+ MESSAGE(SEND_ERROR "VersionTestC_FIND_VERSION_TWEAK=${VersionTestC_FIND_VERSION_TWEAK} is not 0")
+ENDIF(NOT "${VersionTestC_FIND_VERSION_TWEAK}" STREQUAL "0")
+IF(NOT "${VersionTestC_FIND_VERSION_COUNT}" STREQUAL "3")
+ MESSAGE(SEND_ERROR "VersionTestC_FIND_VERSION_COUNT=${VersionTestC_FIND_VERSION_COUNT} is not 3")
+ENDIF(NOT "${VersionTestC_FIND_VERSION_COUNT}" STREQUAL "3")
diff --git a/Tests/FindPackageTest/FindVersionTestD.cmake b/Tests/FindPackageTest/FindVersionTestD.cmake
new file mode 100644
index 000000000..d3e3f509e
--- /dev/null
+++ b/Tests/FindPackageTest/FindVersionTestD.cmake
@@ -0,0 +1,18 @@
+IF(NOT "${VersionTestD_FIND_VERSION}" STREQUAL "1.2.3.4")
+ MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION=${VersionTestD_FIND_VERSION} is not 1.2.3.4")
+ENDIF(NOT "${VersionTestD_FIND_VERSION}" STREQUAL "1.2.3.4")
+IF(NOT "${VersionTestD_FIND_VERSION_MAJOR}" STREQUAL "1")
+ MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION_MAJOR=${VersionTestD_FIND_VERSION_MAJOR} is not 1")
+ENDIF(NOT "${VersionTestD_FIND_VERSION_MAJOR}" STREQUAL "1")
+IF(NOT "${VersionTestD_FIND_VERSION_MINOR}" STREQUAL "2")
+ MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION_MINOR=${VersionTestD_FIND_VERSION_MINOR} is not 2")
+ENDIF(NOT "${VersionTestD_FIND_VERSION_MINOR}" STREQUAL "2")
+IF(NOT "${VersionTestD_FIND_VERSION_PATCH}" STREQUAL "3")
+ MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION_PATCH=${VersionTestD_FIND_VERSION_PATCH} is not 3")
+ENDIF(NOT "${VersionTestD_FIND_VERSION_PATCH}" STREQUAL "3")
+IF(NOT "${VersionTestD_FIND_VERSION_TWEAK}" STREQUAL "4")
+ MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION_TWEAK=${VersionTestD_FIND_VERSION_TWEAK} is not 4")
+ENDIF(NOT "${VersionTestD_FIND_VERSION_TWEAK}" STREQUAL "4")
+IF(NOT "${VersionTestD_FIND_VERSION_COUNT}" STREQUAL "4")
+ MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION_COUNT=${VersionTestD_FIND_VERSION_COUNT} is not 4")
+ENDIF(NOT "${VersionTestD_FIND_VERSION_COUNT}" STREQUAL "4")
diff --git a/Tests/FindPackageTest/RelocatableConfig.cmake.in b/Tests/FindPackageTest/RelocatableConfig.cmake.in
new file mode 100644
index 000000000..4a4b4e9c6
--- /dev/null
+++ b/Tests/FindPackageTest/RelocatableConfig.cmake.in
@@ -0,0 +1,11 @@
+@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@")
+
+set(Relocatable_AComp_FOUND TRUE)
+set(Relocatable_BComp_FOUND FALSE)
+set(Relocatable_CComp_FOUND FALSE)
+
+check_required_components(Relocatable)
diff --git a/Tests/FindPackageTest/SystemPackage/CMakeTestSystemPackageConfig.cmake b/Tests/FindPackageTest/SystemPackage/CMakeTestSystemPackageConfig.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/SystemPackage/CMakeTestSystemPackageConfig.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/TApp.app/Contents/Resources/TAppConfig.cmake b/Tests/FindPackageTest/TApp.app/Contents/Resources/TAppConfig.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/TApp.app/Contents/Resources/TAppConfig.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/TApp.app/Contents/Resources/cmake/tapp-config.cmake b/Tests/FindPackageTest/TApp.app/Contents/Resources/cmake/tapp-config.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/TApp.app/Contents/Resources/cmake/tapp-config.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake b/Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/tframework-config.cmake b/Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/tframework-config.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/tframework-config.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/cmake/SetFoundFALSEConfig.cmake b/Tests/FindPackageTest/cmake/SetFoundFALSEConfig.cmake
new file mode 100644
index 000000000..ae6bd1454
--- /dev/null
+++ b/Tests/FindPackageTest/cmake/SetFoundFALSEConfig.cmake
@@ -0,0 +1 @@
+set(SetFoundFALSE_FOUND FALSE)
diff --git a/Tests/FindPackageTest/cmake/SetFoundTRUEConfig.cmake b/Tests/FindPackageTest/cmake/SetFoundTRUEConfig.cmake
new file mode 100644
index 000000000..19d071144
--- /dev/null
+++ b/Tests/FindPackageTest/cmake/SetFoundTRUEConfig.cmake
@@ -0,0 +1 @@
+set(SetFoundTRUE_FOUND TRUE)
diff --git a/Tests/FindPackageTest/include/foo.h b/Tests/FindPackageTest/include/foo.h
new file mode 100644
index 000000000..2392aee71
--- /dev/null
+++ b/Tests/FindPackageTest/include/foo.h
@@ -0,0 +1 @@
+/* empty header file */
diff --git a/Tests/FindPackageTest/lib/Bar/BarConfig.cmake b/Tests/FindPackageTest/lib/Bar/BarConfig.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/lib/Bar/BarConfig.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/lib/Bar/cmake/bar-config.cmake b/Tests/FindPackageTest/lib/Bar/cmake/bar-config.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/lib/Bar/cmake/bar-config.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/lib/Blub/BlubConfig.cmake b/Tests/FindPackageTest/lib/Blub/BlubConfig.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/lib/Blub/BlubConfig.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake b/Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake
new file mode 100644
index 000000000..eff4d4fd0
--- /dev/null
+++ b/Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake
@@ -0,0 +1,4 @@
+# Test config file.
+if(NOT "${RecursiveA_FIND_COMPONENTS}" STREQUAL "A")
+ message(FATAL_ERROR "find_package(RecursiveA NO_MODULE) did not forward components")
+endif()
diff --git a/Tests/FindPackageTest/lib/TApp/TAppConfig.cmake b/Tests/FindPackageTest/lib/TApp/TAppConfig.cmake
new file mode 100644
index 000000000..cbf06036e
--- /dev/null
+++ b/Tests/FindPackageTest/lib/TApp/TAppConfig.cmake
@@ -0,0 +1,2 @@
+# Test config file that should not be found.
+MESSAGE("Package TApp found non-bundle first!")
diff --git a/Tests/FindPackageTest/lib/arch/Bar/BarConfig.cmake b/Tests/FindPackageTest/lib/arch/Bar/BarConfig.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/lib/arch/Bar/BarConfig.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config-version.cmake b/Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config-version.cmake
new file mode 100644
index 000000000..2f768e8f5
--- /dev/null
+++ b/Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config-version.cmake
@@ -0,0 +1,7 @@
+SET(PACKAGE_VERSION 4.0)
+IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 4)
+ SET(PACKAGE_VERSION_COMPATIBLE 1)
+ IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 0)
+ SET(PACKAGE_VERSION_EXACT 1)
+ ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 0)
+ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 4)
diff --git a/Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config.cmake b/Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/lib/arch/cmake/zot-4.0/zot-config.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/lib/arch/foo-1.2/CMake/FooConfig.cmake b/Tests/FindPackageTest/lib/arch/foo-1.2/CMake/FooConfig.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/lib/arch/foo-1.2/CMake/FooConfig.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/lib/arch/zot-3.1/zot-config-version.cmake b/Tests/FindPackageTest/lib/arch/zot-3.1/zot-config-version.cmake
new file mode 100644
index 000000000..13763adf1
--- /dev/null
+++ b/Tests/FindPackageTest/lib/arch/zot-3.1/zot-config-version.cmake
@@ -0,0 +1,7 @@
+SET(PACKAGE_VERSION 3.1)
+IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3)
+ SET(PACKAGE_VERSION_COMPATIBLE 1)
+ IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1)
+ SET(PACKAGE_VERSION_EXACT 1)
+ ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1)
+ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3)
diff --git a/Tests/FindPackageTest/lib/arch/zot-3.1/zot-config.cmake b/Tests/FindPackageTest/lib/arch/zot-3.1/zot-config.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/lib/arch/zot-3.1/zot-config.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config-version.cmake b/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config-version.cmake
new file mode 100644
index 000000000..bee2f0eea
--- /dev/null
+++ b/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config-version.cmake
@@ -0,0 +1,4 @@
+# Claim to be any version to test that CMAKE_IGNORE_PATH hides us.
+SET(PACKAGE_VERSION 3.1)
+SET(PACKAGE_VERSION_COMPATIBLE 1)
+SET(PACKAGE_VERSION_EXACT 1)
diff --git a/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config.cmake b/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config.cmake
new file mode 100644
index 000000000..2fbd525f3
--- /dev/null
+++ b/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config.cmake
@@ -0,0 +1,2 @@
+# Test config file.
+message(WARNING "CMAKE_IGNORE_PATH failed to ignore this file!")
diff --git a/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake b/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake
new file mode 100644
index 000000000..606945f2d
--- /dev/null
+++ b/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake
@@ -0,0 +1,8 @@
+SET(PACKAGE_VERSION 4.0)
+IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 4)
+ SET(PACKAGE_VERSION_COMPATIBLE 1)
+ IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 0)
+ SET(PACKAGE_VERSION_EXACT 1)
+ ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 0)
+ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 4)
+
diff --git a/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config.cmake b/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/lib/foo-1.2/CMake/FooConfig.cmake b/Tests/FindPackageTest/lib/foo-1.2/CMake/FooConfig.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/lib/foo-1.2/CMake/FooConfig.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/lib/foo-1.2/foo-config.cmake b/Tests/FindPackageTest/lib/foo-1.2/foo-config.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/lib/foo-1.2/foo-config.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/lib/suffix/test/SuffixTestConfig.cmake b/Tests/FindPackageTest/lib/suffix/test/SuffixTestConfig.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/lib/suffix/test/SuffixTestConfig.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/lib/suffix/test/SuffixTestConfigVersion.cmake b/Tests/FindPackageTest/lib/suffix/test/SuffixTestConfigVersion.cmake
new file mode 100644
index 000000000..5c3bddece
--- /dev/null
+++ b/Tests/FindPackageTest/lib/suffix/test/SuffixTestConfigVersion.cmake
@@ -0,0 +1,7 @@
+SET(PACKAGE_VERSION 1.2)
+IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1)
+ SET(PACKAGE_VERSION_COMPATIBLE 1)
+ IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 2)
+ SET(PACKAGE_VERSION_EXACT 1)
+ ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 2)
+ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1)
diff --git a/Tests/FindPackageTest/lib/zot-1.0/zot-config.cmake b/Tests/FindPackageTest/lib/zot-1.0/zot-config.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/lib/zot-1.0/zot-config.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/lib/zot-2.0/zot-config-version.cmake b/Tests/FindPackageTest/lib/zot-2.0/zot-config-version.cmake
new file mode 100644
index 000000000..10ac53d19
--- /dev/null
+++ b/Tests/FindPackageTest/lib/zot-2.0/zot-config-version.cmake
@@ -0,0 +1,5 @@
+SET(PACKAGE_VERSION 2.0)
+IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 2)
+ SET(PACKAGE_VERSION_COMPATIBLE 1)
+ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 2)
+
diff --git a/Tests/FindPackageTest/lib/zot-2.0/zot-config.cmake b/Tests/FindPackageTest/lib/zot-2.0/zot-config.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/lib/zot-2.0/zot-config.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/lib/zot-3.0/zot-config-version.cmake b/Tests/FindPackageTest/lib/zot-3.0/zot-config-version.cmake
new file mode 100644
index 000000000..af57cfa5c
--- /dev/null
+++ b/Tests/FindPackageTest/lib/zot-3.0/zot-config-version.cmake
@@ -0,0 +1,5 @@
+SET(PACKAGE_VERSION 3.0)
+IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3)
+ SET(PACKAGE_VERSION_COMPATIBLE 1)
+ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3)
+
diff --git a/Tests/FindPackageTest/lib/zot-3.0/zot-config.cmake b/Tests/FindPackageTest/lib/zot-3.0/zot-config.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/lib/zot-3.0/zot-config.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/lib/zot-3.1/zot-config-version.cmake b/Tests/FindPackageTest/lib/zot-3.1/zot-config-version.cmake
new file mode 100644
index 000000000..b54d94ce6
--- /dev/null
+++ b/Tests/FindPackageTest/lib/zot-3.1/zot-config-version.cmake
@@ -0,0 +1,8 @@
+SET(PACKAGE_VERSION 3.1)
+IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3)
+ SET(PACKAGE_VERSION_COMPATIBLE 1)
+ IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1)
+ SET(PACKAGE_VERSION_EXACT 1)
+ ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1)
+ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3)
+
diff --git a/Tests/FindPackageTest/lib/zot-3.1/zot-config.cmake b/Tests/FindPackageTest/lib/zot-3.1/zot-config.cmake
new file mode 100644
index 000000000..deffa5729
--- /dev/null
+++ b/Tests/FindPackageTest/lib/zot-3.1/zot-config.cmake
@@ -0,0 +1 @@
+# Test config file.
diff --git a/Tests/FindPackageTest/lib/zot/zot-config-version.cmake b/Tests/FindPackageTest/lib/zot/zot-config-version.cmake
new file mode 100644
index 000000000..2a6be8640
--- /dev/null
+++ b/Tests/FindPackageTest/lib/zot/zot-config-version.cmake
@@ -0,0 +1,10 @@
+# This version should never, ever be used.
+SET(PACKAGE_VERSION_UNSUITABLE 1)
+SET(PACKAGE_VERSION 3.1)
+IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3)
+ SET(PACKAGE_VERSION_COMPATIBLE 1)
+ IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1)
+ SET(PACKAGE_VERSION_EXACT 1)
+ ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1)
+ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3)
+
diff --git a/Tests/FindPackageTest/lib/zot/zot-config.cmake b/Tests/FindPackageTest/lib/zot/zot-config.cmake
new file mode 100644
index 000000000..442b8a4ec
--- /dev/null
+++ b/Tests/FindPackageTest/lib/zot/zot-config.cmake
@@ -0,0 +1,2 @@
+# Test config file that is unsuitable.
+MESSAGE(FATAL_ERROR "Unsuitable version of zot was found")