summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/find_package
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/find_package')
-rw-r--r--Tests/RunCMake/find_package/CMP0074-OLD-stderr.txt12
-rw-r--r--Tests/RunCMake/find_package/CMP0074-OLD.cmake2
-rw-r--r--Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt32
-rw-r--r--Tests/RunCMake/find_package/CMP0074-WARN.cmake2
-rw-r--r--Tests/RunCMake/find_package/CMP0074-common.cmake46
-rw-r--r--Tests/RunCMake/find_package/CMP0084-NEW-stderr.txt20
-rw-r--r--Tests/RunCMake/find_package/CMP0084-NEW.cmake7
-rw-r--r--Tests/RunCMake/find_package/CMP0084-OLD.cmake7
-rw-r--r--Tests/RunCMake/find_package/CMP0084-WARN-stderr.txt8
-rw-r--r--Tests/RunCMake/find_package/CMP0084-WARN.cmake6
-rw-r--r--Tests/RunCMake/find_package/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/find_package/ComponentRequiredAndOptional-result.txt1
-rw-r--r--Tests/RunCMake/find_package/ComponentRequiredAndOptional-stderr.txt8
-rw-r--r--Tests/RunCMake/find_package/ComponentRequiredAndOptional.cmake1
-rw-r--r--Tests/RunCMake/find_package/EmptyVersionRange-result.txt1
-rw-r--r--Tests/RunCMake/find_package/EmptyVersionRange-stderr.txt10
-rw-r--r--Tests/RunCMake/find_package/EmptyVersionRange.cmake3
-rw-r--r--Tests/RunCMake/find_package/FindVersionRange.cmake82
-rw-r--r--Tests/RunCMake/find_package/FromPATHEnv-stderr.txt20
-rw-r--r--Tests/RunCMake/find_package/FromPATHEnv-stdout.txt9
-rw-r--r--Tests/RunCMake/find_package/FromPATHEnv.cmake33
-rw-r--r--Tests/RunCMake/find_package/FromPrefixPath-stdout.txt9
-rw-r--r--Tests/RunCMake/find_package/FromPrefixPath.cmake29
-rw-r--r--Tests/RunCMake/find_package/MissingConfig-stderr.txt4
-rw-r--r--Tests/RunCMake/find_package/MissingConfig-stdout.txt1
-rw-r--r--Tests/RunCMake/find_package/MissingConfig.cmake2
-rw-r--r--Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt18
-rw-r--r--Tests/RunCMake/find_package/MissingConfigDebug.cmake4
-rw-r--r--Tests/RunCMake/find_package/MissingConfigNormal-stdout.txt1
-rw-r--r--Tests/RunCMake/find_package/MissingConfigOneName-stdout.txt1
-rw-r--r--Tests/RunCMake/find_package/MissingConfigOneName.cmake1
-rw-r--r--Tests/RunCMake/find_package/MissingConfigRequired-result.txt1
-rw-r--r--Tests/RunCMake/find_package/MissingConfigRequired-stderr.txt13
-rw-r--r--Tests/RunCMake/find_package/MissingConfigRequired.cmake2
-rw-r--r--Tests/RunCMake/find_package/MissingConfigVersion-stdout.txt1
-rw-r--r--Tests/RunCMake/find_package/MissingConfigVersion.cmake1
-rw-r--r--Tests/RunCMake/find_package/MissingModule-stderr.txt26
-rw-r--r--Tests/RunCMake/find_package/MissingModule.cmake2
-rw-r--r--Tests/RunCMake/find_package/MissingModuleRequired-result.txt1
-rw-r--r--Tests/RunCMake/find_package/MissingModuleRequired-stderr.txt21
-rw-r--r--Tests/RunCMake/find_package/MissingModuleRequired.cmake2
-rw-r--r--Tests/RunCMake/find_package/MissingNormal-stderr.txt23
-rw-r--r--Tests/RunCMake/find_package/MissingNormal.cmake2
-rw-r--r--Tests/RunCMake/find_package/MissingNormalRequired-result.txt1
-rw-r--r--Tests/RunCMake/find_package/MissingNormalRequired-stderr.txt17
-rw-r--r--Tests/RunCMake/find_package/MissingNormalRequired.cmake2
-rw-r--r--Tests/RunCMake/find_package/MissingNormalVersion-stderr.txt17
-rw-r--r--Tests/RunCMake/find_package/MissingNormalVersion.cmake1
-rw-r--r--Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew-stderr.txt30
-rw-r--r--Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew.cmake3
-rw-r--r--Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt30
-rw-r--r--Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld.cmake2
-rw-r--r--Tests/RunCMake/find_package/MixedModeOptions-result.txt1
-rw-r--r--Tests/RunCMake/find_package/MixedModeOptions-stderr.txt14
-rw-r--r--Tests/RunCMake/find_package/MixedModeOptions.cmake1
-rw-r--r--Tests/RunCMake/find_package/PackageRoot-stderr.txt43
-rw-r--r--Tests/RunCMake/find_package/PackageRoot.cmake53
-rw-r--r--Tests/RunCMake/find_package/PackageRoot/BarConfig.cmake9
-rw-r--r--Tests/RunCMake/find_package/PackageRoot/FindBar.cmake9
-rw-r--r--Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake11
-rw-r--r--Tests/RunCMake/find_package/PackageRoot/ResolvedConfig.cmake1
-rwxr-xr-xTests/RunCMake/find_package/PackageRoot/bar/cmake_root/bin/bar.exe0
-rw-r--r--Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/bar.h0
-rw-r--r--Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/zot/zot.h0
-rwxr-xr-xTests/RunCMake/find_package/PackageRoot/bar/env_root/bin/bar.exe0
-rw-r--r--Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/bar.h0
-rw-r--r--Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/zot/zot.h0
-rwxr-xr-xTests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/bar.exe0
-rwxr-xr-xTests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/foo.exe0
-rw-r--r--Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/cmake/BarConfig.cmake9
-rw-r--r--Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/bar.h0
-rw-r--r--Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/foo.h0
-rw-r--r--Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/zot/zot.h0
-rwxr-xr-xTests/RunCMake/find_package/PackageRoot/foo/env_root/bin/bar.exe0
-rwxr-xr-xTests/RunCMake/find_package/PackageRoot/foo/env_root/bin/foo.exe0
-rw-r--r--Tests/RunCMake/find_package/PackageRoot/foo/env_root/cmake/BarConfig.cmake9
-rw-r--r--Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/bar.h0
-rw-r--r--Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/foo.h0
-rw-r--r--Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/zot/zot.h0
-rw-r--r--Tests/RunCMake/find_package/PackageRootNestedConfig-stderr.txt298
-rw-r--r--Tests/RunCMake/find_package/PackageRootNestedConfig.cmake141
-rw-r--r--Tests/RunCMake/find_package/PackageRootNestedModule-stderr.txt298
-rw-r--r--Tests/RunCMake/find_package/PackageRootNestedModule.cmake141
-rw-r--r--Tests/RunCMake/find_package/PolicyPop-result.txt1
-rw-r--r--Tests/RunCMake/find_package/PolicyPop-stderr.txt5
-rw-r--r--Tests/RunCMake/find_package/PolicyPop.cmake1
-rw-r--r--Tests/RunCMake/find_package/PolicyPop/PolicyPopConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/PolicyPop/PolicyPopConfigVersion.cmake3
-rw-r--r--Tests/RunCMake/find_package/PolicyPush-result.txt1
-rw-r--r--Tests/RunCMake/find_package/PolicyPush-stderr.txt5
-rw-r--r--Tests/RunCMake/find_package/PolicyPush.cmake1
-rw-r--r--Tests/RunCMake/find_package/PolicyPush/PolicyPushConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/PolicyPush/PolicyPushConfigVersion.cmake3
-rw-r--r--Tests/RunCMake/find_package/RunCMakeTest.cmake45
-rw-r--r--Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt9
-rw-r--r--Tests/RunCMake/find_package/SetFoundFALSE.cmake2
-rw-r--r--Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake1
-rw-r--r--Tests/RunCMake/find_package/SetFoundResolved-stderr.txt10
-rw-r--r--Tests/RunCMake/find_package/SetFoundResolved.cmake17
-rw-r--r--Tests/RunCMake/find_package/VersionRange.cmake37
-rw-r--r--Tests/RunCMake/find_package/VersionRange2.cmake37
-rw-r--r--Tests/RunCMake/find_package/VersionRange3.cmake49
-rw-r--r--Tests/RunCMake/find_package/VersionRange4.cmake39
-rw-r--r--Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfigVersion.cmake74
-rw-r--r--Tests/RunCMake/find_package/VersionRangeConfig.cmake23
-rw-r--r--Tests/RunCMake/find_package/VersionRangeConfig2.cmake23
-rw-r--r--Tests/RunCMake/find_package/VersionRangeConfigStd.cmake23
-rw-r--r--Tests/RunCMake/find_package/VersionRangeConfigStd2.cmake23
-rw-r--r--Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfigVersion.cmake24
-rw-r--r--Tests/RunCMake/find_package/VersionRangeWithEXACT-result.txt1
-rw-r--r--Tests/RunCMake/find_package/VersionRangeWithEXACT-stderr.txt2
-rw-r--r--Tests/RunCMake/find_package/VersionRangeWithEXACT.cmake1
-rw-r--r--Tests/RunCMake/find_package/VersionedA-1/VersionedAConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/VersionedA-1/VersionedAConfigVersion.cmake4
-rw-r--r--Tests/RunCMake/find_package/VersionedA-2/VersionedAConfig.cmake0
-rw-r--r--Tests/RunCMake/find_package/VersionedA-2/VersionedAConfigVersion.cmake4
-rw-r--r--Tests/RunCMake/find_package/WrongVersion-stderr.txt11
-rw-r--r--Tests/RunCMake/find_package/WrongVersion.cmake2
-rw-r--r--Tests/RunCMake/find_package/WrongVersionConfig-stderr.txt11
-rw-r--r--Tests/RunCMake/find_package/WrongVersionConfig.cmake2
-rw-r--r--Tests/RunCMake/find_package/WrongVersionRange-result.txt1
-rw-r--r--Tests/RunCMake/find_package/WrongVersionRange-stderr.txt28
-rw-r--r--Tests/RunCMake/find_package/WrongVersionRange.cmake9
125 files changed, 2151 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_package/CMP0074-OLD-stderr.txt b/Tests/RunCMake/find_package/CMP0074-OLD-stderr.txt
new file mode 100644
index 0000000..4c2e517
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0074-OLD-stderr.txt
@@ -0,0 +1,12 @@
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/env_root
+
+find_package\(Foo\)
+FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
+FOO_TEST_FILE_ZOT :FOO_TEST_FILE_ZOT-NOTFOUND
+FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
+FOO_TEST_PATH_ZOT :FOO_TEST_PATH_ZOT-NOTFOUND
+FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
+
+----------
diff --git a/Tests/RunCMake/find_package/CMP0074-OLD.cmake b/Tests/RunCMake/find_package/CMP0074-OLD.cmake
new file mode 100644
index 0000000..4358317
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0074-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0074 OLD)
+include(CMP0074-common.cmake)
diff --git a/Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt b/Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt
new file mode 100644
index 0000000..fc08163
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt
@@ -0,0 +1,32 @@
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/env_root
++
+CMake Warning \(dev\) at CMP0074-common.cmake:[0-9]+ \(find_package\):
+ Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
+ Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy
+ command to set the policy and suppress this warning.
+
+ CMake variable Foo_ROOT is set to:
+
+ .*/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root
+
+ Environment variable Foo_ROOT is set to:
+
+ .*/Tests/RunCMake/find_package/PackageRoot/foo/env_root
+
+ For compatibility, CMake is ignoring the variable.
+Call Stack \(most recent call first\):
+ CMP0074-common.cmake:[0-9]+ \(RunPackageRootTest\)
+ CMP0074-WARN.cmake:[0-9]+ \(include\)
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
++
+find_package\(Foo\)
+FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
+FOO_TEST_FILE_ZOT :FOO_TEST_FILE_ZOT-NOTFOUND
+FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
+FOO_TEST_PATH_ZOT :FOO_TEST_PATH_ZOT-NOTFOUND
+FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
+
+----------
diff --git a/Tests/RunCMake/find_package/CMP0074-WARN.cmake b/Tests/RunCMake/find_package/CMP0074-WARN.cmake
new file mode 100644
index 0000000..0d4ada7
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0074-WARN.cmake
@@ -0,0 +1,2 @@
+# (do not set CMP0074)
+include(CMP0074-common.cmake)
diff --git a/Tests/RunCMake/find_package/CMP0074-common.cmake b/Tests/RunCMake/find_package/CMP0074-common.cmake
new file mode 100644
index 0000000..bfacd82
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0074-common.cmake
@@ -0,0 +1,46 @@
+# (includer selects CMP0074)
+cmake_policy(SET CMP0057 NEW)
+list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
+set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
+
+function(PrintPath label path)
+ string(REPLACE "${PackageRoot_BASE}" "<base>" out "${path}")
+ message("${label}${out}")
+endfunction()
+
+macro(CleanUpPackageRootTest)
+ unset(Foo_ROOT)
+ unset(ENV{Foo_ROOT})
+ unset(FOO_TEST_FILE_FOO)
+ unset(FOO_TEST_FILE_ZOT)
+ unset(FOO_TEST_PATH_FOO)
+ unset(FOO_TEST_PATH_ZOT)
+ unset(FOO_TEST_PROG_FOO)
+ unset(FOO_TEST_FILE_FOO CACHE)
+ unset(FOO_TEST_FILE_ZOT CACHE)
+ unset(FOO_TEST_PATH_FOO CACHE)
+ unset(FOO_TEST_PATH_ZOT CACHE)
+ unset(FOO_TEST_PROG_FOO CACHE)
+endmacro()
+
+macro(RunPackageRootTest)
+ message("----------")
+ PrintPath("Foo_ROOT :" "${Foo_ROOT}")
+ PrintPath("ENV{Foo_ROOT} :" "$ENV{Foo_ROOT}")
+ message("")
+
+ find_package(Foo)
+ message("find_package(Foo)")
+ PrintPath("FOO_TEST_FILE_FOO :" "${FOO_TEST_FILE_FOO}")
+ PrintPath("FOO_TEST_FILE_ZOT :" "${FOO_TEST_FILE_ZOT}")
+ PrintPath("FOO_TEST_PATH_FOO :" "${FOO_TEST_PATH_FOO}")
+ PrintPath("FOO_TEST_PATH_ZOT :" "${FOO_TEST_PATH_ZOT}")
+ PrintPath("FOO_TEST_PROG_FOO :" "${FOO_TEST_PROG_FOO}")
+ CleanUpPackageRootTest()
+ message("")
+endmacro()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
+RunPackageRootTest()
+message("----------")
diff --git a/Tests/RunCMake/find_package/CMP0084-NEW-stderr.txt b/Tests/RunCMake/find_package/CMP0084-NEW-stderr.txt
new file mode 100644
index 0000000..280ff8c
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0084-NEW-stderr.txt
@@ -0,0 +1,20 @@
+^CMake Warning at CMP0084-NEW\.cmake:[0-9]+ \(find_package\):
+ No "FindQt\.cmake" found in CMAKE_MODULE_PATH\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:3 \(include\)
++
+CMake Warning \(dev\) at CMP0084-NEW\.cmake:[0-9]+ \(find_package\):
+ FindQt\.cmake must either be part of this project itself, in this case
+ adjust CMAKE_MODULE_PATH so that it points to the correct location inside
+ its source tree\.
+
+ Or it must be installed by a package which has already been found via
+ find_package\(\)\. In this case make sure that package has indeed been found
+ and adjust CMAKE_MODULE_PATH to contain the location where that package has
+ installed FindQt\.cmake\. This must be a location provided by that package\.
+ This error in general means that the buildsystem of this project is relying
+ on a Find-module without ensuring that it is actually available\.
+
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.$
diff --git a/Tests/RunCMake/find_package/CMP0084-NEW.cmake b/Tests/RunCMake/find_package/CMP0084-NEW.cmake
new file mode 100644
index 0000000..68fd6cf
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0084-NEW.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0084 NEW)
+set(_findqt_testing TRUE)
+find_package(Qt MODULE)
+
+if(_findqt_included)
+ message(FATAL_ERROR "FindQt.cmake erroneously included")
+endif()
diff --git a/Tests/RunCMake/find_package/CMP0084-OLD.cmake b/Tests/RunCMake/find_package/CMP0084-OLD.cmake
new file mode 100644
index 0000000..7bd4726
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0084-OLD.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0084 OLD)
+set(_findqt_testing TRUE)
+find_package(Qt MODULE)
+
+if(NOT _findqt_included)
+ message(FATAL_ERROR "FindQt.cmake not included")
+endif()
diff --git a/Tests/RunCMake/find_package/CMP0084-WARN-stderr.txt b/Tests/RunCMake/find_package/CMP0084-WARN-stderr.txt
new file mode 100644
index 0000000..9ecebd3
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0084-WARN-stderr.txt
@@ -0,0 +1,8 @@
+^CMake Warning \(dev\) at CMP0084-WARN\.cmake:[0-9]+ \(find_package\):
+ Policy CMP0084 is not set: The FindQt module does not exist for
+ find_package\(\)\. Run "cmake --help-policy CMP0084" for policy details\. Use
+ the cmake_policy command to set the policy and suppress this warning\.
+
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.$
diff --git a/Tests/RunCMake/find_package/CMP0084-WARN.cmake b/Tests/RunCMake/find_package/CMP0084-WARN.cmake
new file mode 100644
index 0000000..4ea22cb
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMP0084-WARN.cmake
@@ -0,0 +1,6 @@
+set(_findqt_testing TRUE)
+find_package(Qt MODULE)
+
+if(NOT _findqt_included)
+ message(FATAL_ERROR "FindQt.cmake not included")
+endif()
diff --git a/Tests/RunCMake/find_package/CMakeLists.txt b/Tests/RunCMake/find_package/CMakeLists.txt
new file mode 100644
index 0000000..74b3ff8
--- /dev/null
+++ b/Tests/RunCMake/find_package/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.3)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/find_package/ComponentRequiredAndOptional-result.txt b/Tests/RunCMake/find_package/ComponentRequiredAndOptional-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/find_package/ComponentRequiredAndOptional-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/ComponentRequiredAndOptional-stderr.txt b/Tests/RunCMake/find_package/ComponentRequiredAndOptional-stderr.txt
new file mode 100644
index 0000000..db8f512
--- /dev/null
+++ b/Tests/RunCMake/find_package/ComponentRequiredAndOptional-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at ComponentRequiredAndOptional.cmake:1 \(find_package\):
+ find_package called with components that are both required and optional:
+
+ CompA
+ CompB
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/find_package/ComponentRequiredAndOptional.cmake b/Tests/RunCMake/find_package/ComponentRequiredAndOptional.cmake
new file mode 100644
index 0000000..0355f5a
--- /dev/null
+++ b/Tests/RunCMake/find_package/ComponentRequiredAndOptional.cmake
@@ -0,0 +1 @@
+find_package(NotHere REQUIRED CompA CompB CompC OPTIONAL_COMPONENTS CompA CompB CompD)
diff --git a/Tests/RunCMake/find_package/EmptyVersionRange-result.txt b/Tests/RunCMake/find_package/EmptyVersionRange-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/find_package/EmptyVersionRange-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/EmptyVersionRange-stderr.txt b/Tests/RunCMake/find_package/EmptyVersionRange-stderr.txt
new file mode 100644
index 0000000..9c00b96
--- /dev/null
+++ b/Tests/RunCMake/find_package/EmptyVersionRange-stderr.txt
@@ -0,0 +1,10 @@
+CMake Error at EmptyVersionRange.cmake:[0-9]+ \(find_package\):
+ find_package specified version range is empty.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+
+
+CMake Error at EmptyVersionRange.cmake:[0-9]+ \(find_package\):
+ find_package specified version range is empty.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_package/EmptyVersionRange.cmake b/Tests/RunCMake/find_package/EmptyVersionRange.cmake
new file mode 100644
index 0000000..553e297
--- /dev/null
+++ b/Tests/RunCMake/find_package/EmptyVersionRange.cmake
@@ -0,0 +1,3 @@
+find_package(VersionRange 2.3...1.2)
+
+find_package(VersionRange 2.3...<2.3)
diff --git a/Tests/RunCMake/find_package/FindVersionRange.cmake b/Tests/RunCMake/find_package/FindVersionRange.cmake
new file mode 100644
index 0000000..27e5b90
--- /dev/null
+++ b/Tests/RunCMake/find_package/FindVersionRange.cmake
@@ -0,0 +1,82 @@
+
+if (NOT VersionRange_FIND_VERSION_COMPLETE STREQUAL VersionRange_SPECIFIED_VERSION_COMPLETE)
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_COMPLETE: ${VersionRange_FIND_VERSION_COMPLETE}")
+endif()
+
+if (NOT VersionRange_FIND_VERSION VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN)
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION: ${VersionRange_FIND_VERSION}")
+endif()
+if (NOT VersionRange_FIND_VERSION_MAJOR VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN_MAJOR)
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MAJOR: ${VersionRange_FIND_VERSION_MAJOR}")
+endif()
+if (NOT VersionRange_FIND_VERSION_MINOR VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN_MINOR)
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MINOR: ${VersionRange_FIND_VERSION_MINOR}")
+endif()
+if (NOT VersionRange_FIND_VERSION_PATCH VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN_PATCH)
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_PATCH: ${VersionRange_FIND_VERSION_PATCH}")
+endif()
+if (NOT VersionRange_FIND_VERSION_TWEAK VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN_TWEAK)
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_TWEAK: ${VersionRange_FIND_VERSION_TWEAK}")
+endif()
+
+if (NOT VersionRange_FIND_VERSION_RANGE STREQUAL VersionRange_SPECIFIED_VERSION_RANGE)
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_RANGE: ${VersionRange_FIND_VERSION_RANGE}")
+endif()
+if (NOT VersionRange_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE")
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_RANGE_MIN: ${VersionRange_FIND_VERSION_RANGE_MIN}")
+endif()
+if (VersionRange_FIND_VERSION_RANGE MATCHES "<[0-9.]+$")
+ if (NOT VersionRange_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE")
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_RANGE_MAX: ${VersionRange_FIND_VERSION_RANGE_MAX}")
+ endif()
+else()
+ if (NOT VersionRange_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE")
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_RANGE_MAX: ${VersionRange_FIND_VERSION_RANGE_MAX}")
+ endif()
+endif()
+
+if (NOT VersionRange_FIND_VERSION_MIN VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN)
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MIN: ${VersionRange_FIND_VERSION_MIN}")
+endif()
+if (NOT VersionRange_FIND_VERSION_MIN_MAJOR VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN_MAJOR)
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MIN_MAJOR: ${VersionRange_FIND_VERSION_MIN_MAJOR}")
+endif()
+if (NOT VersionRange_FIND_VERSION_MIN_MINOR VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN_MINOR)
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MIN_MINOR: ${VersionRange_FIND_VERSION_MIN_MINOR}")
+endif()
+if (NOT VersionRange_FIND_VERSION_MIN_PATCH VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN_PATCH)
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MIN_PATCH: ${VersionRange_FIND_VERSION_MIN_PATCH}")
+endif()
+if (NOT VersionRange_FIND_VERSION_MIN_TWEAK VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MIN_TWEAK)
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MIN_TWEAK: ${VersionRange_FIND_VERSION_MIN_TWEAK}")
+endif()
+
+if (NOT VersionRange_FIND_VERSION_MAX VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MAX)
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MAX: ${VersionRange_FIND_VERSION_MAX}")
+endif()
+if (NOT VersionRange_FIND_VERSION_MAX_MAJOR VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MAX_MAJOR)
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MAX_MAJOR: ${VersionRange_FIND_VERSION_MAX_MAJOR}")
+endif()
+if (NOT VersionRange_FIND_VERSION_MAX_MINOR VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MAX_MINOR)
+ message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MAX_MINOR: ${VersionRange_FIND_VERSION_MAX_MINOR}")
+endif()
+if (NOT VersionRange_FIND_VERSION_MAX_PATCH VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MAX_PATCH)
+ message (SEND_ERROR "Wrong value for VersionRange_VERSION_FIND_MAX_PATCH: ${VersionRange_FIND_VERSION_MAX_PATCH}")
+endif()
+if (NOT VersionRange_FIND_VERSION_MAX_TWEAK VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MAX_TWEAK)
+ message (SEND_ERROR "Wrong value for VersionRange_VERSION_FIND_MAX_TWEAK: ${VersionRange_FIND_VERSION_MAX_TWEAK}")
+endif()
+
+if ((VersionRange_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE"
+ AND "2.3.4.5" VERSION_LESS_EQUAL VersionRange_FIND_VERSION_MAX)
+ OR (VersionRange_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE"
+ AND "2.3.4.5" VERSION_LESS VersionRange_FIND_VERSION_MAX))
+set (VersionRange_FOUND TRUE)
+set (VersionRange_VERSION 2.3.4.5)
+set (VersionRange_VERSION_MAJOR 2)
+set (VersionRange_VERSION_MINOR 3)
+set (VersionRange_VERSION_PATCH 4)
+set (VersionRange_VERSION_TWEAK 5)
+else()
+ set (VersionRange_FOUND FALSE)
+endif()
diff --git a/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt b/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt
new file mode 100644
index 0000000..b35f05e
--- /dev/null
+++ b/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt
@@ -0,0 +1,20 @@
+CMake Debug Log at FromPATHEnv.cmake:5 \(find_package\):
+ find_package considered the following paths for Resolved.cmake.*
+.*/Modules/FindResolved.cmake.*
+ The file was not found.*
+ <PackageName>_ROOT CMake variable.*
+ CMAKE_PREFIX_PATH variable.*
+ CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH variables.*
+ Env variable Resolved_DIR.*
+ CMAKE_PREFIX_PATH env variable.*
+ Paths specified by the find_package HINTS option.*
+ Standard system environment variables.*
+.*Tests/RunCMake/find_package/PackageRoot.*
+ CMake User Package Registry.*
+ CMake variables defined in the Platform file.*
+ CMake System Package Registry.*
+ Paths specified by the find_package PATHS option.*
+ find_package considered the following locations for the Config module:.*
+.*Tests/RunCMake/find_package/PackageRoot/ResolvedConfig\.cmake.*
+ The file was found at.*
+.*Tests/RunCMake/find_package/PackageRoot/ResolvedConfig\.cmake
diff --git a/Tests/RunCMake/find_package/FromPATHEnv-stdout.txt b/Tests/RunCMake/find_package/FromPATHEnv-stdout.txt
new file mode 100644
index 0000000..2ead349
--- /dev/null
+++ b/Tests/RunCMake/find_package/FromPATHEnv-stdout.txt
@@ -0,0 +1,9 @@
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='1'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
diff --git a/Tests/RunCMake/find_package/FromPATHEnv.cmake b/Tests/RunCMake/find_package/FromPATHEnv.cmake
new file mode 100644
index 0000000..ceb79b6
--- /dev/null
+++ b/Tests/RunCMake/find_package/FromPATHEnv.cmake
@@ -0,0 +1,33 @@
+set(ENV_PATH "$ENV{PATH}")
+
+set(CMAKE_FIND_DEBUG_MODE ON)
+set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot")
+find_package(Resolved QUIET)
+set(CMAKE_FIND_DEBUG_MODE OFF)
+
+foreach(path "/does_not_exist" "/PackageRoot" "")
+ unset(Resolved_FOUND CACHE)
+ set(Resolved_DIR "")
+ set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}")
+ find_package(Resolved QUIET)
+ message(STATUS "Resolved_FOUND='${Resolved_FOUND}'")
+endforeach()
+
+set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF)
+foreach(path "/does_not_exist" "/PackageRoot" "")
+ unset(Resolved_FOUND CACHE)
+ set(Resolved_DIR "")
+ set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}")
+ find_package(Resolved QUIET)
+ message(STATUS "Resolved_FOUND='${Resolved_FOUND}'")
+endforeach()
+
+set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ON)
+foreach(path "/does_not_exist" "/PackageRoot" "")
+ unset(Resolved_FOUND CACHE)
+ set(Resolved_DIR "")
+ set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}")
+ find_package(Resolved NO_SYSTEM_ENVIRONMENT_PATH QUIET)
+ message(STATUS "Resolved_FOUND='${Resolved_FOUND}'")
+endforeach()
+set(ENV{PATH} "${ENV_PATH}")
diff --git a/Tests/RunCMake/find_package/FromPrefixPath-stdout.txt b/Tests/RunCMake/find_package/FromPrefixPath-stdout.txt
new file mode 100644
index 0000000..2ead349
--- /dev/null
+++ b/Tests/RunCMake/find_package/FromPrefixPath-stdout.txt
@@ -0,0 +1,9 @@
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='1'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
diff --git a/Tests/RunCMake/find_package/FromPrefixPath.cmake b/Tests/RunCMake/find_package/FromPrefixPath.cmake
new file mode 100644
index 0000000..be853c1
--- /dev/null
+++ b/Tests/RunCMake/find_package/FromPrefixPath.cmake
@@ -0,0 +1,29 @@
+set(ENV_PATH "$ENV{PATH}")
+set(ENV{PATH} "")
+foreach(path "/does_not_exist" "/PackageRoot" "")
+ unset(Resolved_FOUND CACHE)
+ set(Resolved_DIR "")
+ set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}${path}")
+ find_package(Resolved QUIET)
+ message(STATUS "Resolved_FOUND='${Resolved_FOUND}'")
+endforeach()
+
+set(CMAKE_FIND_USE_CMAKE_PATH OFF)
+set(CMAKE_PREFIX_PATH )
+foreach(path "/does_not_exist" "/PackageRoot" "")
+ unset(Resolved_FOUND CACHE)
+ set(Resolved_DIR "")
+ set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}${path}")
+ find_package(Resolved QUIET)
+ message(STATUS "Resolved_FOUND='${Resolved_FOUND}'")
+endforeach()
+
+set(CMAKE_FIND_USE_CMAKE_PATH ON)
+foreach(path "/does_not_exist" "/PackageRoot" "")
+ unset(Resolved_FOUND CACHE)
+ set(Resolved_DIR "")
+ set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}${path}")
+ find_package(Resolved NO_CMAKE_PATH QUIET)
+ message(STATUS "Resolved_FOUND='${Resolved_FOUND}'")
+endforeach()
+set(ENV{PATH} "${ENV_PATH}")
diff --git a/Tests/RunCMake/find_package/MissingConfig-stderr.txt b/Tests/RunCMake/find_package/MissingConfig-stderr.txt
new file mode 100644
index 0000000..33ff545
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfig-stderr.txt
@@ -0,0 +1,4 @@
+CMake Warning at MissingConfig.cmake:2 \(message\):
+ This warning must be reachable.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/find_package/MissingConfig-stdout.txt b/Tests/RunCMake/find_package/MissingConfig-stdout.txt
new file mode 100644
index 0000000..7af632b
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfig-stdout.txt
@@ -0,0 +1 @@
+-- Could NOT find NotHere \(missing: NotHere_DIR\)
diff --git a/Tests/RunCMake/find_package/MissingConfig.cmake b/Tests/RunCMake/find_package/MissingConfig.cmake
new file mode 100644
index 0000000..238e7e4
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfig.cmake
@@ -0,0 +1,2 @@
+find_package(NotHere CONFIG)
+message(WARNING "This warning must be reachable.")
diff --git a/Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt b/Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt
new file mode 100644
index 0000000..379bf7a
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt
@@ -0,0 +1,18 @@
+ <PackageName>_ROOT CMake variable.*
+ CMAKE_PREFIX_PATH variable.*
+ CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH variables.*
+ Env variable NotHere_DIR.*
+ CMAKE_PREFIX_PATH env variable.*
+ Standard system environment variables.*
+ CMake User Package Registry.*
+ CMake variables defined in the Platform file.*
+ CMake System Package Registry.*
+ Paths specified by the find_package PATHS option.*
+.*
+ .*NotHereConfig.cmake
+ .*nothere-config.cmake
+.*
+CMake Warning at MissingConfigDebug.cmake:3 \(message\):
+ This warning must be reachable.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/find_package/MissingConfigDebug.cmake b/Tests/RunCMake/find_package/MissingConfigDebug.cmake
new file mode 100644
index 0000000..4e3bb22
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigDebug.cmake
@@ -0,0 +1,4 @@
+set(CMAKE_FIND_DEBUG_MODE ON)
+find_package(NotHere CONFIG)
+message(WARNING "This warning must be reachable.")
+set(CMAKE_FIND_DEBUG_MODE OFF)
diff --git a/Tests/RunCMake/find_package/MissingConfigNormal-stdout.txt b/Tests/RunCMake/find_package/MissingConfigNormal-stdout.txt
new file mode 100644
index 0000000..7af632b
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigNormal-stdout.txt
@@ -0,0 +1 @@
+-- Could NOT find NotHere \(missing: NotHere_DIR\)
diff --git a/Tests/RunCMake/find_package/MissingConfigOneName-stdout.txt b/Tests/RunCMake/find_package/MissingConfigOneName-stdout.txt
new file mode 100644
index 0000000..7af632b
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigOneName-stdout.txt
@@ -0,0 +1 @@
+-- Could NOT find NotHere \(missing: NotHere_DIR\)
diff --git a/Tests/RunCMake/find_package/MissingConfigOneName.cmake b/Tests/RunCMake/find_package/MissingConfigOneName.cmake
new file mode 100644
index 0000000..11676a9
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigOneName.cmake
@@ -0,0 +1 @@
+find_package(NotHere CONFIGS NotHereConfig.cmake)
diff --git a/Tests/RunCMake/find_package/MissingConfigRequired-result.txt b/Tests/RunCMake/find_package/MissingConfigRequired-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigRequired-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/MissingConfigRequired-stderr.txt b/Tests/RunCMake/find_package/MissingConfigRequired-stderr.txt
new file mode 100644
index 0000000..2ba774a
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigRequired-stderr.txt
@@ -0,0 +1,13 @@
+CMake Error at MissingConfigRequired.cmake:1 \(find_package\):
+ Could not find a package configuration file provided by "NotHere" with any
+ of the following names:
+
+ NotHereConfig.cmake
+ nothere-config.cmake
+
+ Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
+ "NotHere_DIR" to a directory containing one of the above files. If
+ "NotHere" provides a separate development package or SDK, be sure it has
+ been installed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/find_package/MissingConfigRequired.cmake b/Tests/RunCMake/find_package/MissingConfigRequired.cmake
new file mode 100644
index 0000000..0ae6702
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigRequired.cmake
@@ -0,0 +1,2 @@
+find_package(NotHere CONFIG REQUIRED)
+message(FATAL_ERROR "This error must not be reachable.")
diff --git a/Tests/RunCMake/find_package/MissingConfigVersion-stdout.txt b/Tests/RunCMake/find_package/MissingConfigVersion-stdout.txt
new file mode 100644
index 0000000..7af632b
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigVersion-stdout.txt
@@ -0,0 +1 @@
+-- Could NOT find NotHere \(missing: NotHere_DIR\)
diff --git a/Tests/RunCMake/find_package/MissingConfigVersion.cmake b/Tests/RunCMake/find_package/MissingConfigVersion.cmake
new file mode 100644
index 0000000..ac35a79
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigVersion.cmake
@@ -0,0 +1 @@
+find_package(NotHere 1.2 CONFIG)
diff --git a/Tests/RunCMake/find_package/MissingModule-stderr.txt b/Tests/RunCMake/find_package/MissingModule-stderr.txt
new file mode 100644
index 0000000..2ad460f
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingModule-stderr.txt
@@ -0,0 +1,26 @@
+CMake Warning at MissingModule.cmake:1 \(find_package\):
+ No "FindNotHere.cmake" found in CMAKE_MODULE_PATH.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+
+
+CMake Warning \(dev\) at MissingModule.cmake:1 \(find_package\):
+ FindNotHere.cmake must either be part of this project itself, in this case
+ adjust CMAKE_MODULE_PATH so that it points to the correct location inside
+ its source tree.
+
+ Or it must be installed by a package which has already been found via
+ find_package\(\). In this case make sure that package has indeed been found
+ and adjust CMAKE_MODULE_PATH to contain the location where that package has
+ installed FindNotHere.cmake. This must be a location provided by that
+ package. This error in general means that the buildsystem of this project
+ is relying on a Find-module without ensuring that it is actually available.
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning at MissingModule.cmake:2 \(message\):
+ This warning must be reachable.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/find_package/MissingModule.cmake b/Tests/RunCMake/find_package/MissingModule.cmake
new file mode 100644
index 0000000..76bcef2
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingModule.cmake
@@ -0,0 +1,2 @@
+find_package(NotHere MODULE)
+message(WARNING "This warning must be reachable.")
diff --git a/Tests/RunCMake/find_package/MissingModuleRequired-result.txt b/Tests/RunCMake/find_package/MissingModuleRequired-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingModuleRequired-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/MissingModuleRequired-stderr.txt b/Tests/RunCMake/find_package/MissingModuleRequired-stderr.txt
new file mode 100644
index 0000000..fec05f1
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingModuleRequired-stderr.txt
@@ -0,0 +1,21 @@
+CMake Error at MissingModuleRequired.cmake:1 \(find_package\):
+ No "FindNotHere.cmake" found in CMAKE_MODULE_PATH.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+
+
+CMake Warning \(dev\) at MissingModuleRequired.cmake:1 \(find_package\):
+ FindNotHere.cmake must either be part of this project itself, in this case
+ adjust CMAKE_MODULE_PATH so that it points to the correct location inside
+ its source tree.
+
+ Or it must be installed by a package which has already been found via
+ find_package\(\). In this case make sure that package has indeed been found
+ and adjust CMAKE_MODULE_PATH to contain the location where that package has
+ installed FindNotHere.cmake. This must be a location provided by that
+ package. This error in general means that the buildsystem of this project
+ is relying on a Find-module without ensuring that it is actually available.
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/find_package/MissingModuleRequired.cmake b/Tests/RunCMake/find_package/MissingModuleRequired.cmake
new file mode 100644
index 0000000..897eda6
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingModuleRequired.cmake
@@ -0,0 +1,2 @@
+find_package(NotHere MODULE REQUIRED)
+message(FATAL_ERROR "This error must not be reachable.")
diff --git a/Tests/RunCMake/find_package/MissingNormal-stderr.txt b/Tests/RunCMake/find_package/MissingNormal-stderr.txt
new file mode 100644
index 0000000..f4c6fba
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormal-stderr.txt
@@ -0,0 +1,23 @@
+CMake Warning at MissingNormal.cmake:1 \(find_package\):
+ By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has
+ asked CMake to find a package configuration file provided by "NotHere", but
+ CMake did not find one.
+
+ Could not find a package configuration file provided by "NotHere" with any
+ of the following names:
+
+ NotHereConfig.cmake
+ nothere-config.cmake
+
+ Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
+ "NotHere_DIR" to a directory containing one of the above files. If
+ "NotHere" provides a separate development package or SDK, be sure it has
+ been installed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+
+
+CMake Warning at MissingNormal.cmake:2 \(message\):
+ This warning must be reachable.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/find_package/MissingNormal.cmake b/Tests/RunCMake/find_package/MissingNormal.cmake
new file mode 100644
index 0000000..fb90e01
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormal.cmake
@@ -0,0 +1,2 @@
+find_package(NotHere)
+message(WARNING "This warning must be reachable.")
diff --git a/Tests/RunCMake/find_package/MissingNormalRequired-result.txt b/Tests/RunCMake/find_package/MissingNormalRequired-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalRequired-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/MissingNormalRequired-stderr.txt b/Tests/RunCMake/find_package/MissingNormalRequired-stderr.txt
new file mode 100644
index 0000000..7bb7902
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalRequired-stderr.txt
@@ -0,0 +1,17 @@
+CMake Error at MissingNormalRequired.cmake:1 \(find_package\):
+ By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has
+ asked CMake to find a package configuration file provided by "NotHere", but
+ CMake did not find one.
+
+ Could not find a package configuration file provided by "NotHere" with any
+ of the following names:
+
+ NotHereConfig.cmake
+ nothere-config.cmake
+
+ Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
+ "NotHere_DIR" to a directory containing one of the above files. If
+ "NotHere" provides a separate development package or SDK, be sure it has
+ been installed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/find_package/MissingNormalRequired.cmake b/Tests/RunCMake/find_package/MissingNormalRequired.cmake
new file mode 100644
index 0000000..33353d8
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalRequired.cmake
@@ -0,0 +1,2 @@
+find_package(NotHere REQUIRED)
+message(FATAL_ERROR "This error must not be reachable.")
diff --git a/Tests/RunCMake/find_package/MissingNormalVersion-stderr.txt b/Tests/RunCMake/find_package/MissingNormalVersion-stderr.txt
new file mode 100644
index 0000000..36de800
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalVersion-stderr.txt
@@ -0,0 +1,17 @@
+CMake Warning at MissingNormalVersion.cmake:1 \(find_package\):
+ By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has
+ asked CMake to find a package configuration file provided by "NotHere", but
+ CMake did not find one.
+
+ Could not find a package configuration file provided by "NotHere"
+ \(requested version 1\.2\) with any of the following names:
+
+ NotHereConfig.cmake
+ nothere-config.cmake
+
+ Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
+ "NotHere_DIR" to a directory containing one of the above files. If
+ "NotHere" provides a separate development package or SDK, be sure it has
+ been installed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/find_package/MissingNormalVersion.cmake b/Tests/RunCMake/find_package/MissingNormalVersion.cmake
new file mode 100644
index 0000000..2d9ce4e
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalVersion.cmake
@@ -0,0 +1 @@
+find_package(NotHere 1.2)
diff --git a/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew-stderr.txt b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew-stderr.txt
new file mode 100644
index 0000000..d34f23c
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew-stderr.txt
@@ -0,0 +1,30 @@
+CMake Warning \(dev\) at MissingNormalWarnNoModuleNew.cmake:3 \(find_package\):
+ find_package called without either MODULE or CONFIG option and no
+ FindNotHere.cmake module is in CMAKE_MODULE_PATH. Add MODULE to
+ exclusively request Module mode and fail if FindNotHere.cmake is missing.
+ Add CONFIG to exclusively request Config mode and search for a package
+ configuration file provided by NotHere \(NotHereConfig.cmake or
+ nothere-config.cmake\).
+
+ \(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this warning.\)
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning at MissingNormalWarnNoModuleNew.cmake:3 \(find_package\):
+ By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has
+ asked CMake to find a package configuration file provided by "NotHere", but
+ CMake did not find one.
+
+ Could not find a package configuration file provided by "NotHere" with any
+ of the following names:
+
+ NotHereConfig.cmake
+ nothere-config.cmake
+
+ Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
+ "NotHere_DIR" to a directory containing one of the above files. If
+ "NotHere" provides a separate development package or SDK, be sure it has
+ been installed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew.cmake b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew.cmake
new file mode 100644
index 0000000..0211249
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleNew.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_FIND_PACKAGE_WARN_NO_MODULE 1)
+set(CMAKE_MINIMUM_REQUIRED_VERSION 2.8.8)
+find_package(NotHere)
diff --git a/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt
new file mode 100644
index 0000000..ebfd7d0
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld-stderr.txt
@@ -0,0 +1,30 @@
+CMake Warning \(dev\) at MissingNormalWarnNoModuleOld.cmake:2 \(find_package\):
+ find_package called without either MODULE or CONFIG option and no
+ FindNotHere.cmake module is in CMAKE_MODULE_PATH. Add MODULE to
+ exclusively request Module mode and fail if FindNotHere.cmake is missing.
+ Add CONFIG to exclusively request Config mode and search for a package
+ configuration file provided by NotHere \(NotHereConfig.cmake or
+ nothere-config.cmake\).
+
+ \(Variable CMAKE_FIND_PACKAGE_WARN_NO_MODULE enabled this warning.\)
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Warning at MissingNormalWarnNoModuleOld.cmake:2 \(find_package\):
+ By not providing "FindNotHere.cmake" in CMAKE_MODULE_PATH this project has
+ asked CMake to find a package configuration file provided by "NotHere", but
+ CMake did not find one.
+
+ Could not find a package configuration file provided by "NotHere" with any
+ of the following names:
+
+ NotHereConfig.cmake
+ nothere-config.cmake
+
+ Add the installation prefix of "NotHere" to CMAKE_PREFIX_PATH or set
+ "NotHere_DIR" to a directory containing one of the above files. If
+ "NotHere" provides a separate development package or SDK, be sure it has
+ been installed.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld.cmake b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld.cmake
new file mode 100644
index 0000000..1c4a775
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingNormalWarnNoModuleOld.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_FIND_PACKAGE_WARN_NO_MODULE 1)
+find_package(NotHere)
diff --git a/Tests/RunCMake/find_package/MixedModeOptions-result.txt b/Tests/RunCMake/find_package/MixedModeOptions-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/find_package/MixedModeOptions-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/MixedModeOptions-stderr.txt b/Tests/RunCMake/find_package/MixedModeOptions-stderr.txt
new file mode 100644
index 0000000..b867022
--- /dev/null
+++ b/Tests/RunCMake/find_package/MixedModeOptions-stderr.txt
@@ -0,0 +1,14 @@
+CMake Error at MixedModeOptions.cmake:1 \(find_package\):
+ find_package given options exclusive to Module mode:
+
+ MODULE
+
+ and options exclusive to Config mode:
+
+ CONFIG
+ CONFIGS
+ NO_DEFAULT_PATH
+
+ The options are incompatible.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/find_package/MixedModeOptions.cmake b/Tests/RunCMake/find_package/MixedModeOptions.cmake
new file mode 100644
index 0000000..7f78ee0
--- /dev/null
+++ b/Tests/RunCMake/find_package/MixedModeOptions.cmake
@@ -0,0 +1 @@
+find_package(NotHere MODULE CONFIG CONFIGS NotHereConfig.cmake NO_DEFAULT_PATH)
diff --git a/Tests/RunCMake/find_package/PackageRoot-stderr.txt b/Tests/RunCMake/find_package/PackageRoot-stderr.txt
new file mode 100644
index 0000000..2ec324a
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot-stderr.txt
@@ -0,0 +1,43 @@
+----------
+Foo_ROOT :
+ENV{Foo_ROOT} :
+
+find_package\(Foo\)
+FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
+FOO_TEST_FILE_ZOT :FOO_TEST_FILE_ZOT-NOTFOUND
+FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
+FOO_TEST_PATH_ZOT :FOO_TEST_PATH_ZOT-NOTFOUND
+FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :
+
+find_package\(Foo\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+
+----------
+Foo_ROOT :
+ENV{Foo_ROOT} :<base>/foo/env_root
+
+find_package\(Foo\)
+FOO_TEST_FILE_FOO :<base>/foo/env_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/env_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/env_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/env_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/env_root/bin/foo.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/env_root
+
+find_package\(Foo\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
diff --git a/Tests/RunCMake/find_package/PackageRoot.cmake b/Tests/RunCMake/find_package/PackageRoot.cmake
new file mode 100644
index 0000000..aa12e9b
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot.cmake
@@ -0,0 +1,53 @@
+cmake_policy(SET CMP0057 NEW)
+cmake_policy(SET CMP0074 NEW)
+list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
+set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
+
+function(PrintPath label path)
+ string(REPLACE "${PackageRoot_BASE}" "<base>" out "${path}")
+ message("${label}${out}")
+endfunction()
+
+macro(CleanUpPackageRootTest)
+ unset(Foo_ROOT)
+ unset(ENV{Foo_ROOT})
+ unset(FOO_TEST_FILE_FOO)
+ unset(FOO_TEST_FILE_ZOT)
+ unset(FOO_TEST_PATH_FOO)
+ unset(FOO_TEST_PATH_ZOT)
+ unset(FOO_TEST_PROG_FOO)
+ unset(FOO_TEST_FILE_FOO CACHE)
+ unset(FOO_TEST_FILE_ZOT CACHE)
+ unset(FOO_TEST_PATH_FOO CACHE)
+ unset(FOO_TEST_PATH_ZOT CACHE)
+ unset(FOO_TEST_PROG_FOO CACHE)
+endmacro()
+
+macro(RunPackageRootTest)
+ message("----------")
+ PrintPath("Foo_ROOT :" "${Foo_ROOT}")
+ PrintPath("ENV{Foo_ROOT} :" "$ENV{Foo_ROOT}")
+ message("")
+
+ find_package(Foo)
+ message("find_package(Foo)")
+ PrintPath("FOO_TEST_FILE_FOO :" "${FOO_TEST_FILE_FOO}")
+ PrintPath("FOO_TEST_FILE_ZOT :" "${FOO_TEST_FILE_ZOT}")
+ PrintPath("FOO_TEST_PATH_FOO :" "${FOO_TEST_PATH_FOO}")
+ PrintPath("FOO_TEST_PATH_ZOT :" "${FOO_TEST_PATH_ZOT}")
+ PrintPath("FOO_TEST_PROG_FOO :" "${FOO_TEST_PROG_FOO}")
+ CleanUpPackageRootTest()
+ message("")
+endmacro()
+
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+RunPackageRootTest()
+
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
+RunPackageRootTest()
diff --git a/Tests/RunCMake/find_package/PackageRoot/BarConfig.cmake b/Tests/RunCMake/find_package/PackageRoot/BarConfig.cmake
new file mode 100644
index 0000000..9eaf386
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/BarConfig.cmake
@@ -0,0 +1,9 @@
+set(BAR_CMAKE_FILE ${CMAKE_CURRENT_LIST_FILE} CACHE FILEPATH "")
+find_file(BAR_TEST_FILE_FOO foo.h)
+find_file(BAR_TEST_FILE_BAR bar.h)
+find_file(BAR_TEST_FILE_ZOT zot.h PATH_SUFFIXES zot)
+find_path(BAR_TEST_PATH_FOO foo.h)
+find_path(BAR_TEST_PATH_BAR bar.h)
+find_path(BAR_TEST_PATH_ZOT zot.h PATH_SUFFIXES zot)
+find_program(BAR_TEST_PROG_FOO foo.exe)
+find_program(BAR_TEST_PROG_BAR bar.exe)
diff --git a/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake b/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake
new file mode 100644
index 0000000..9eaf386
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake
@@ -0,0 +1,9 @@
+set(BAR_CMAKE_FILE ${CMAKE_CURRENT_LIST_FILE} CACHE FILEPATH "")
+find_file(BAR_TEST_FILE_FOO foo.h)
+find_file(BAR_TEST_FILE_BAR bar.h)
+find_file(BAR_TEST_FILE_ZOT zot.h PATH_SUFFIXES zot)
+find_path(BAR_TEST_PATH_FOO foo.h)
+find_path(BAR_TEST_PATH_BAR bar.h)
+find_path(BAR_TEST_PATH_ZOT zot.h PATH_SUFFIXES zot)
+find_program(BAR_TEST_PROG_FOO foo.exe)
+find_program(BAR_TEST_PROG_BAR bar.exe)
diff --git a/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake b/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake
new file mode 100644
index 0000000..b929c2a
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake
@@ -0,0 +1,11 @@
+find_file(FOO_TEST_FILE_FOO foo.h)
+find_file(FOO_TEST_FILE_ZOT zot.h PATH_SUFFIXES zot)
+find_path(FOO_TEST_PATH_FOO foo.h)
+find_path(FOO_TEST_PATH_ZOT zot.h PATH_SUFFIXES zot)
+find_program(FOO_TEST_PROG_FOO foo.exe)
+
+if ("BarModule" IN_LIST Foo_FIND_COMPONENTS)
+ find_package(Bar)
+elseif ("BarConfig" IN_LIST Foo_FIND_COMPONENTS)
+ find_package(Bar CONFIG)
+endif ()
diff --git a/Tests/RunCMake/find_package/PackageRoot/ResolvedConfig.cmake b/Tests/RunCMake/find_package/PackageRoot/ResolvedConfig.cmake
new file mode 100644
index 0000000..4496a05
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/ResolvedConfig.cmake
@@ -0,0 +1 @@
+set(Resolved_DIR "${CMAKE_CURRENT_LIST_DIR}")
diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/bin/bar.exe b/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/bin/bar.exe
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/bin/bar.exe
diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/bar.h b/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/bar.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/bar.h
diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/zot/zot.h b/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/zot/zot.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/zot/zot.h
diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/env_root/bin/bar.exe b/Tests/RunCMake/find_package/PackageRoot/bar/env_root/bin/bar.exe
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/bar/env_root/bin/bar.exe
diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/bar.h b/Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/bar.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/bar.h
diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/zot/zot.h b/Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/zot/zot.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/zot/zot.h
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/bar.exe b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/bar.exe
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/bar.exe
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/foo.exe b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/foo.exe
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/bin/foo.exe
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/cmake/BarConfig.cmake b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/cmake/BarConfig.cmake
new file mode 100644
index 0000000..9eaf386
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/cmake/BarConfig.cmake
@@ -0,0 +1,9 @@
+set(BAR_CMAKE_FILE ${CMAKE_CURRENT_LIST_FILE} CACHE FILEPATH "")
+find_file(BAR_TEST_FILE_FOO foo.h)
+find_file(BAR_TEST_FILE_BAR bar.h)
+find_file(BAR_TEST_FILE_ZOT zot.h PATH_SUFFIXES zot)
+find_path(BAR_TEST_PATH_FOO foo.h)
+find_path(BAR_TEST_PATH_BAR bar.h)
+find_path(BAR_TEST_PATH_ZOT zot.h PATH_SUFFIXES zot)
+find_program(BAR_TEST_PROG_FOO foo.exe)
+find_program(BAR_TEST_PROG_BAR bar.exe)
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/bar.h b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/bar.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/bar.h
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/foo.h b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/foo.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/foo.h
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/zot/zot.h b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/zot/zot.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/zot/zot.h
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/bar.exe b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/bar.exe
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/bar.exe
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/foo.exe b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/foo.exe
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/bin/foo.exe
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/env_root/cmake/BarConfig.cmake b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/cmake/BarConfig.cmake
new file mode 100644
index 0000000..9eaf386
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/cmake/BarConfig.cmake
@@ -0,0 +1,9 @@
+set(BAR_CMAKE_FILE ${CMAKE_CURRENT_LIST_FILE} CACHE FILEPATH "")
+find_file(BAR_TEST_FILE_FOO foo.h)
+find_file(BAR_TEST_FILE_BAR bar.h)
+find_file(BAR_TEST_FILE_ZOT zot.h PATH_SUFFIXES zot)
+find_path(BAR_TEST_PATH_FOO foo.h)
+find_path(BAR_TEST_PATH_BAR bar.h)
+find_path(BAR_TEST_PATH_ZOT zot.h PATH_SUFFIXES zot)
+find_program(BAR_TEST_PROG_FOO foo.exe)
+find_program(BAR_TEST_PROG_BAR bar.exe)
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/bar.h b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/bar.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/bar.h
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/foo.h b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/foo.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/foo.h
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/zot/zot.h b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/zot/zot.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/zot/zot.h
diff --git a/Tests/RunCMake/find_package/PackageRootNestedConfig-stderr.txt b/Tests/RunCMake/find_package/PackageRootNestedConfig-stderr.txt
new file mode 100644
index 0000000..b3ee104
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRootNestedConfig-stderr.txt
@@ -0,0 +1,298 @@
+----------
+Foo_ROOT :
+ENV{Foo_ROOT} :
+Bar_DIR :
+Bar_ROOT :
+ENV{Bar_ROOT} :
+
+find_package\(Foo COMPONENTS BarConfig\)
+FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
+FOO_TEST_FILE_ZOT :FOO_TEST_FILE_ZOT-NOTFOUND
+FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
+FOO_TEST_PATH_ZOT :FOO_TEST_PATH_ZOT-NOTFOUND
+FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
+BAR_CMAKE_FILE :
+BAR_TEST_FILE_FOO :
+BAR_TEST_FILE_BAR :
+BAR_TEST_FILE_ZOT :
+BAR_TEST_PATH_FOO :
+BAR_TEST_PATH_BAR :
+BAR_TEST_PATH_ZOT :
+BAR_TEST_PROG_FOO :
+BAR_TEST_PROG_BAR :
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :
+Bar_DIR :
+Bar_ROOT :
+ENV{Bar_ROOT} :
+
+find_package\(Foo COMPONENTS BarConfig\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/foo/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/foo/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/foo/cmake_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :
+Bar_DIR :
+Bar_ROOT :<base>/bar/cmake_root
+ENV{Bar_ROOT} :
+
+find_package\(Foo COMPONENTS BarConfig\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :
+Bar_DIR :
+Bar_ROOT :
+ENV{Bar_ROOT} :<base>/bar/env_root
+
+find_package\(Foo COMPONENTS BarConfig\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/env_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/env_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/env_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/env_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/env_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :
+Bar_DIR :
+Bar_ROOT :<base>/bar/cmake_root
+ENV{Bar_ROOT} :<base>/bar/env_root
+
+find_package\(Foo COMPONENTS BarConfig\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/cmake_root
+Bar_DIR :
+Bar_ROOT :
+ENV{Bar_ROOT} :
+
+find_package\(Foo COMPONENTS BarConfig\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/foo/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/foo/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/foo/cmake_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/cmake_root
+Bar_DIR :
+Bar_ROOT :<base>/bar/cmake_root
+ENV{Bar_ROOT} :
+
+find_package\(Foo COMPONENTS BarConfig\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/cmake_root
+Bar_DIR :
+Bar_ROOT :
+ENV{Bar_ROOT} :<base>/bar/env_root
+
+find_package\(Foo COMPONENTS BarConfig\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/env_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/env_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/env_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/env_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/env_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/cmake_root
+Bar_DIR :
+Bar_ROOT :<base>/bar/cmake_root
+ENV{Bar_ROOT} :<base>/bar/env_root
+
+find_package\(Foo COMPONENTS BarConfig\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/cmake_root
+Bar_DIR :
+Bar_ROOT :
+ENV{Bar_ROOT} :
+
+find_package\(Foo COMPONENTS BarConfig\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/foo/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/foo/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/foo/cmake_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/cmake_root
+Bar_DIR :
+Bar_ROOT :<base>/bar/cmake_root
+ENV{Bar_ROOT} :
+
+find_package\(Foo COMPONENTS BarConfig\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/cmake_root
+Bar_DIR :
+Bar_ROOT :
+ENV{Bar_ROOT} :<base>/bar/env_root
+
+find_package\(Foo COMPONENTS BarConfig\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/env_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/env_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/env_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/env_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/env_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/cmake_root
+Bar_DIR :
+Bar_ROOT :<base>/bar/cmake_root
+ENV{Bar_ROOT} :<base>/bar/env_root
+
+find_package\(Foo COMPONENTS BarConfig\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/foo/cmake_root/cmake/BarConfig.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe
diff --git a/Tests/RunCMake/find_package/PackageRootNestedConfig.cmake b/Tests/RunCMake/find_package/PackageRootNestedConfig.cmake
new file mode 100644
index 0000000..1ef32cb
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRootNestedConfig.cmake
@@ -0,0 +1,141 @@
+cmake_policy(SET CMP0057 NEW)
+cmake_policy(SET CMP0074 NEW)
+list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
+set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
+
+function(PrintPath label path)
+ string(REPLACE "${PackageRoot_BASE}" "<base>" out "${path}")
+ message("${label}${out}")
+endfunction()
+
+macro(CleanUpPackageRootTest)
+ unset(Foo_ROOT)
+ unset(ENV{Foo_ROOT})
+ unset(Bar_DIR)
+ unset(BAR_CMAKE_FILE)
+ unset(Bar_ROOT)
+ unset(ENV{Bar_ROOT})
+ unset(FOO_TEST_FILE_FOO)
+ unset(FOO_TEST_FILE_ZOT)
+ unset(FOO_TEST_PATH_FOO)
+ unset(FOO_TEST_PATH_ZOT)
+ unset(FOO_TEST_PROG_FOO)
+ unset(BAR_TEST_FILE_FOO)
+ unset(BAR_TEST_FILE_BAR)
+ unset(BAR_TEST_FILE_ZOT)
+ unset(BAR_TEST_PATH_FOO)
+ unset(BAR_TEST_PATH_BAR)
+ unset(BAR_TEST_PATH_ZOT)
+ unset(BAR_TEST_PROG_FOO)
+ unset(BAR_TEST_PROG_BAR)
+ unset(Bar_DIR CACHE)
+ unset(BAR_CMAKE_FILE CACHE)
+ unset(FOO_TEST_FILE_FOO CACHE)
+ unset(FOO_TEST_FILE_ZOT CACHE)
+ unset(FOO_TEST_PATH_FOO CACHE)
+ unset(FOO_TEST_PATH_ZOT CACHE)
+ unset(FOO_TEST_PROG_FOO CACHE)
+ unset(BAR_TEST_FILE_FOO CACHE)
+ unset(BAR_TEST_FILE_BAR CACHE)
+ unset(BAR_TEST_FILE_ZOT CACHE)
+ unset(BAR_TEST_PATH_FOO CACHE)
+ unset(BAR_TEST_PATH_BAR CACHE)
+ unset(BAR_TEST_PATH_ZOT CACHE)
+ unset(BAR_TEST_PROG_FOO CACHE)
+ unset(BAR_TEST_PROG_BAR CACHE)
+endmacro()
+
+macro(RunPackageRootTest)
+ message("----------")
+ PrintPath("Foo_ROOT :" "${Foo_ROOT}")
+ PrintPath("ENV{Foo_ROOT} :" "$ENV{Foo_ROOT}")
+ PrintPath("Bar_DIR :" "${Bar_DIR}")
+ PrintPath("Bar_ROOT :" "${Bar_ROOT}")
+ PrintPath("ENV{Bar_ROOT} :" "$ENV{Bar_ROOT}")
+ message("")
+
+ find_package(Foo COMPONENTS BarConfig)
+ message("find_package(Foo COMPONENTS BarConfig)")
+ PrintPath("FOO_TEST_FILE_FOO :" "${FOO_TEST_FILE_FOO}")
+ PrintPath("FOO_TEST_FILE_ZOT :" "${FOO_TEST_FILE_ZOT}")
+ PrintPath("FOO_TEST_PATH_FOO :" "${FOO_TEST_PATH_FOO}")
+ PrintPath("FOO_TEST_PATH_ZOT :" "${FOO_TEST_PATH_ZOT}")
+ PrintPath("FOO_TEST_PROG_FOO :" "${FOO_TEST_PROG_FOO}")
+ PrintPath("BAR_CMAKE_FILE :" "${BAR_CMAKE_FILE}")
+ PrintPath("BAR_TEST_FILE_FOO :" "${BAR_TEST_FILE_FOO}")
+ PrintPath("BAR_TEST_FILE_BAR :" "${BAR_TEST_FILE_BAR}")
+ PrintPath("BAR_TEST_FILE_ZOT :" "${BAR_TEST_FILE_ZOT}")
+ PrintPath("BAR_TEST_PATH_FOO :" "${BAR_TEST_PATH_FOO}")
+ PrintPath("BAR_TEST_PATH_BAR :" "${BAR_TEST_PATH_BAR}")
+ PrintPath("BAR_TEST_PATH_ZOT :" "${BAR_TEST_PATH_ZOT}")
+ PrintPath("BAR_TEST_PROG_FOO :" "${BAR_TEST_PROG_FOO}")
+ PrintPath("BAR_TEST_PROG_BAR :" "${BAR_TEST_PROG_BAR}")
+ CleanUpPackageRootTest()
+ message("")
+endmacro()
+
+#
+
+RunPackageRootTest()
+
+#
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
+
+#
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
+set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
+set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
+
+#
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
+set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
+set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
diff --git a/Tests/RunCMake/find_package/PackageRootNestedModule-stderr.txt b/Tests/RunCMake/find_package/PackageRootNestedModule-stderr.txt
new file mode 100644
index 0000000..0ca2bdd
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRootNestedModule-stderr.txt
@@ -0,0 +1,298 @@
+----------
+Foo_ROOT :
+ENV{Foo_ROOT} :
+Bar_DIR :
+Bar_ROOT :
+ENV{Bar_ROOT} :
+
+find_package\(Foo COMPONENTS BarModule\)
+FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
+FOO_TEST_FILE_ZOT :FOO_TEST_FILE_ZOT-NOTFOUND
+FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
+FOO_TEST_PATH_ZOT :FOO_TEST_PATH_ZOT-NOTFOUND
+FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
+BAR_CMAKE_FILE :<base>/FindBar.cmake
+BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND
+BAR_TEST_FILE_BAR :BAR_TEST_FILE_BAR-NOTFOUND
+BAR_TEST_FILE_ZOT :BAR_TEST_FILE_ZOT-NOTFOUND
+BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND
+BAR_TEST_PATH_BAR :BAR_TEST_PATH_BAR-NOTFOUND
+BAR_TEST_PATH_ZOT :BAR_TEST_PATH_ZOT-NOTFOUND
+BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND
+BAR_TEST_PROG_BAR :BAR_TEST_PROG_BAR-NOTFOUND
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :
+Bar_DIR :
+Bar_ROOT :
+ENV{Bar_ROOT} :
+
+find_package\(Foo COMPONENTS BarModule\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/FindBar.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/foo/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/foo/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/foo/cmake_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :
+Bar_DIR :
+Bar_ROOT :<base>/bar/cmake_root
+ENV{Bar_ROOT} :
+
+find_package\(Foo COMPONENTS BarModule\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/FindBar.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :
+Bar_DIR :
+Bar_ROOT :
+ENV{Bar_ROOT} :<base>/bar/env_root
+
+find_package\(Foo COMPONENTS BarModule\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/FindBar.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/env_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/env_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/env_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/env_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/env_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :
+Bar_DIR :
+Bar_ROOT :<base>/bar/cmake_root
+ENV{Bar_ROOT} :<base>/bar/env_root
+
+find_package\(Foo COMPONENTS BarModule\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/FindBar.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/cmake_root
+Bar_DIR :
+Bar_ROOT :
+ENV{Bar_ROOT} :
+
+find_package\(Foo COMPONENTS BarModule\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/FindBar.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/foo/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/foo/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/foo/cmake_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/cmake_root
+Bar_DIR :
+Bar_ROOT :<base>/bar/cmake_root
+ENV{Bar_ROOT} :
+
+find_package\(Foo COMPONENTS BarModule\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/FindBar.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/cmake_root
+Bar_DIR :
+Bar_ROOT :
+ENV{Bar_ROOT} :<base>/bar/env_root
+
+find_package\(Foo COMPONENTS BarModule\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/FindBar.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/env_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/env_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/env_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/env_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/env_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/cmake_root
+Bar_DIR :
+Bar_ROOT :<base>/bar/cmake_root
+ENV{Bar_ROOT} :<base>/bar/env_root
+
+find_package\(Foo COMPONENTS BarModule\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/FindBar.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/cmake_root
+Bar_DIR :
+Bar_ROOT :
+ENV{Bar_ROOT} :
+
+find_package\(Foo COMPONENTS BarModule\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/FindBar.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/foo/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/foo/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/foo/cmake_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/cmake_root
+Bar_DIR :
+Bar_ROOT :<base>/bar/cmake_root
+ENV{Bar_ROOT} :
+
+find_package\(Foo COMPONENTS BarModule\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/FindBar.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/cmake_root
+Bar_DIR :
+Bar_ROOT :
+ENV{Bar_ROOT} :<base>/bar/env_root
+
+find_package\(Foo COMPONENTS BarModule\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/FindBar.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/env_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/env_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/env_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/env_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/env_root/bin/bar.exe
+
+----------
+Foo_ROOT :<base>/foo/cmake_root
+ENV{Foo_ROOT} :<base>/foo/cmake_root
+Bar_DIR :
+Bar_ROOT :<base>/bar/cmake_root
+ENV{Bar_ROOT} :<base>/bar/env_root
+
+find_package\(Foo COMPONENTS BarModule\)
+FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
+FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
+FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_CMAKE_FILE :<base>/FindBar.cmake
+BAR_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
+BAR_TEST_FILE_BAR :<base>/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :<base>/bar/cmake_root/include/zot/zot.h
+BAR_TEST_PATH_FOO :<base>/foo/cmake_root/include
+BAR_TEST_PATH_BAR :<base>/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :<base>/bar/cmake_root/include/zot
+BAR_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
+BAR_TEST_PROG_BAR :<base>/bar/cmake_root/bin/bar.exe
diff --git a/Tests/RunCMake/find_package/PackageRootNestedModule.cmake b/Tests/RunCMake/find_package/PackageRootNestedModule.cmake
new file mode 100644
index 0000000..017834c
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRootNestedModule.cmake
@@ -0,0 +1,141 @@
+cmake_policy(SET CMP0057 NEW)
+cmake_policy(SET CMP0074 NEW)
+list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
+set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
+
+function(PrintPath label path)
+ string(REPLACE "${PackageRoot_BASE}" "<base>" out "${path}")
+ message("${label}${out}")
+endfunction()
+
+macro(CleanUpPackageRootTest)
+ unset(Foo_ROOT)
+ unset(ENV{Foo_ROOT})
+ unset(Bar_DIR)
+ unset(BAR_CMAKE_FILE)
+ unset(Bar_ROOT)
+ unset(ENV{Bar_ROOT})
+ unset(FOO_TEST_FILE_FOO)
+ unset(FOO_TEST_FILE_ZOT)
+ unset(FOO_TEST_PATH_FOO)
+ unset(FOO_TEST_PATH_ZOT)
+ unset(FOO_TEST_PROG_FOO)
+ unset(BAR_TEST_FILE_FOO)
+ unset(BAR_TEST_FILE_BAR)
+ unset(BAR_TEST_FILE_ZOT)
+ unset(BAR_TEST_PATH_FOO)
+ unset(BAR_TEST_PATH_BAR)
+ unset(BAR_TEST_PATH_ZOT)
+ unset(BAR_TEST_PROG_FOO)
+ unset(BAR_TEST_PROG_BAR)
+ unset(Bar_DIR CACHE)
+ unset(BAR_CMAKE_FILE CACHE)
+ unset(FOO_TEST_FILE_FOO CACHE)
+ unset(FOO_TEST_FILE_ZOT CACHE)
+ unset(FOO_TEST_PATH_FOO CACHE)
+ unset(FOO_TEST_PATH_ZOT CACHE)
+ unset(FOO_TEST_PROG_FOO CACHE)
+ unset(BAR_TEST_FILE_FOO CACHE)
+ unset(BAR_TEST_FILE_BAR CACHE)
+ unset(BAR_TEST_FILE_ZOT CACHE)
+ unset(BAR_TEST_PATH_FOO CACHE)
+ unset(BAR_TEST_PATH_BAR CACHE)
+ unset(BAR_TEST_PATH_ZOT CACHE)
+ unset(BAR_TEST_PROG_FOO CACHE)
+ unset(BAR_TEST_PROG_BAR CACHE)
+endmacro()
+
+macro(RunPackageRootTest)
+ message("----------")
+ PrintPath("Foo_ROOT :" "${Foo_ROOT}")
+ PrintPath("ENV{Foo_ROOT} :" "$ENV{Foo_ROOT}")
+ PrintPath("Bar_DIR :" "${Bar_DIR}")
+ PrintPath("Bar_ROOT :" "${Bar_ROOT}")
+ PrintPath("ENV{Bar_ROOT} :" "$ENV{Bar_ROOT}")
+ message("")
+
+ find_package(Foo COMPONENTS BarModule)
+ message("find_package(Foo COMPONENTS BarModule)")
+ PrintPath("FOO_TEST_FILE_FOO :" "${FOO_TEST_FILE_FOO}")
+ PrintPath("FOO_TEST_FILE_ZOT :" "${FOO_TEST_FILE_ZOT}")
+ PrintPath("FOO_TEST_PATH_FOO :" "${FOO_TEST_PATH_FOO}")
+ PrintPath("FOO_TEST_PATH_ZOT :" "${FOO_TEST_PATH_ZOT}")
+ PrintPath("FOO_TEST_PROG_FOO :" "${FOO_TEST_PROG_FOO}")
+ PrintPath("BAR_CMAKE_FILE :" "${BAR_CMAKE_FILE}")
+ PrintPath("BAR_TEST_FILE_FOO :" "${BAR_TEST_FILE_FOO}")
+ PrintPath("BAR_TEST_FILE_BAR :" "${BAR_TEST_FILE_BAR}")
+ PrintPath("BAR_TEST_FILE_ZOT :" "${BAR_TEST_FILE_ZOT}")
+ PrintPath("BAR_TEST_PATH_FOO :" "${BAR_TEST_PATH_FOO}")
+ PrintPath("BAR_TEST_PATH_BAR :" "${BAR_TEST_PATH_BAR}")
+ PrintPath("BAR_TEST_PATH_ZOT :" "${BAR_TEST_PATH_ZOT}")
+ PrintPath("BAR_TEST_PROG_FOO :" "${BAR_TEST_PROG_FOO}")
+ PrintPath("BAR_TEST_PROG_BAR :" "${BAR_TEST_PROG_BAR}")
+ CleanUpPackageRootTest()
+ message("")
+endmacro()
+
+#
+
+RunPackageRootTest()
+
+#
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
+
+#
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
+set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
+set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
+
+#
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
+set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
+
+set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
+set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
+set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
+set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
+RunPackageRootTest()
diff --git a/Tests/RunCMake/find_package/PolicyPop-result.txt b/Tests/RunCMake/find_package/PolicyPop-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/find_package/PolicyPop-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/PolicyPop-stderr.txt b/Tests/RunCMake/find_package/PolicyPop-stderr.txt
new file mode 100644
index 0000000..745d39a
--- /dev/null
+++ b/Tests/RunCMake/find_package/PolicyPop-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at PolicyPop/PolicyPopConfigVersion.cmake:3 \(cmake_policy\):
+ cmake_policy POP without matching PUSH
+Call Stack \(most recent call first\):
+ PolicyPop.cmake:1 \(find_package\)
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/find_package/PolicyPop.cmake b/Tests/RunCMake/find_package/PolicyPop.cmake
new file mode 100644
index 0000000..4866f24
--- /dev/null
+++ b/Tests/RunCMake/find_package/PolicyPop.cmake
@@ -0,0 +1 @@
+find_package(PolicyPop 1 CONFIG PATHS ${CMAKE_CURRENT_SOURCE_DIR}/PolicyPop NO_DEFAULT_PATH)
diff --git a/Tests/RunCMake/find_package/PolicyPop/PolicyPopConfig.cmake b/Tests/RunCMake/find_package/PolicyPop/PolicyPopConfig.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PolicyPop/PolicyPopConfig.cmake
diff --git a/Tests/RunCMake/find_package/PolicyPop/PolicyPopConfigVersion.cmake b/Tests/RunCMake/find_package/PolicyPop/PolicyPopConfigVersion.cmake
new file mode 100644
index 0000000..483fb10
--- /dev/null
+++ b/Tests/RunCMake/find_package/PolicyPop/PolicyPopConfigVersion.cmake
@@ -0,0 +1,3 @@
+set(PACKAGE_VERSION 1)
+set(PACKAGE_VERSION_COMPATIBLE 1)
+cmake_policy(POP)
diff --git a/Tests/RunCMake/find_package/PolicyPush-result.txt b/Tests/RunCMake/find_package/PolicyPush-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/find_package/PolicyPush-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/PolicyPush-stderr.txt b/Tests/RunCMake/find_package/PolicyPush-stderr.txt
new file mode 100644
index 0000000..73cf2e6
--- /dev/null
+++ b/Tests/RunCMake/find_package/PolicyPush-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error in PolicyPush/PolicyPushConfigVersion.cmake:
+ cmake_policy PUSH without matching POP
+Call Stack \(most recent call first\):
+ PolicyPush.cmake:1 \(find_package\)
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/find_package/PolicyPush.cmake b/Tests/RunCMake/find_package/PolicyPush.cmake
new file mode 100644
index 0000000..30c3ce2
--- /dev/null
+++ b/Tests/RunCMake/find_package/PolicyPush.cmake
@@ -0,0 +1 @@
+find_package(PolicyPush 1 CONFIG PATHS ${CMAKE_CURRENT_SOURCE_DIR}/PolicyPush NO_DEFAULT_PATH)
diff --git a/Tests/RunCMake/find_package/PolicyPush/PolicyPushConfig.cmake b/Tests/RunCMake/find_package/PolicyPush/PolicyPushConfig.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PolicyPush/PolicyPushConfig.cmake
diff --git a/Tests/RunCMake/find_package/PolicyPush/PolicyPushConfigVersion.cmake b/Tests/RunCMake/find_package/PolicyPush/PolicyPushConfigVersion.cmake
new file mode 100644
index 0000000..45a8dbd
--- /dev/null
+++ b/Tests/RunCMake/find_package/PolicyPush/PolicyPushConfigVersion.cmake
@@ -0,0 +1,3 @@
+set(PACKAGE_VERSION 1)
+set(PACKAGE_VERSION_COMPATIBLE 1)
+cmake_policy(PUSH)
diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake
new file mode 100644
index 0000000..a899f46
--- /dev/null
+++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake
@@ -0,0 +1,45 @@
+include(RunCMake)
+
+run_cmake(CMP0074-WARN)
+run_cmake(CMP0074-OLD)
+run_cmake(ComponentRequiredAndOptional)
+run_cmake(FromPATHEnv)
+run_cmake(FromPrefixPath)
+run_cmake(MissingNormal)
+run_cmake(MissingNormalRequired)
+run_cmake(MissingNormalVersion)
+run_cmake(MissingNormalWarnNoModuleOld)
+run_cmake(MissingNormalWarnNoModuleNew)
+run_cmake(MissingModule)
+run_cmake(MissingModuleRequired)
+run_cmake(MissingConfig)
+run_cmake(MissingConfigDebug)
+run_cmake(MissingConfigOneName)
+run_cmake(MissingConfigRequired)
+run_cmake(MissingConfigVersion)
+run_cmake(MixedModeOptions)
+run_cmake(PackageRoot)
+run_cmake(PackageRootNestedConfig)
+run_cmake(PackageRootNestedModule)
+run_cmake(PolicyPush)
+run_cmake(PolicyPop)
+run_cmake(SetFoundFALSE)
+run_cmake(WrongVersion)
+run_cmake(WrongVersionConfig)
+run_cmake(CMP0084-OLD)
+run_cmake(CMP0084-WARN)
+run_cmake(CMP0084-NEW)
+run_cmake(WrongVersionRange)
+run_cmake(EmptyVersionRange)
+run_cmake(VersionRangeWithEXACT)
+run_cmake(VersionRange)
+run_cmake(VersionRange2)
+run_cmake(VersionRange3)
+run_cmake(VersionRange4)
+run_cmake(VersionRangeConfig)
+run_cmake(VersionRangeConfig2)
+run_cmake(VersionRangeConfigStd)
+run_cmake(VersionRangeConfigStd2)
+if(UNIX)
+ run_cmake(SetFoundResolved)
+endif()
diff --git a/Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt b/Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt
new file mode 100644
index 0000000..695f645
--- /dev/null
+++ b/Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning at SetFoundFALSE.cmake:2 \(find_package\):
+ Found package configuration file:
+
+ .*/Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake
+
+ but it set SetFoundFALSE_FOUND to FALSE so package "SetFoundFALSE" is
+ considered to be NOT FOUND.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/find_package/SetFoundFALSE.cmake b/Tests/RunCMake/find_package/SetFoundFALSE.cmake
new file mode 100644
index 0000000..fbcec3c
--- /dev/null
+++ b/Tests/RunCMake/find_package/SetFoundFALSE.cmake
@@ -0,0 +1,2 @@
+set(SetFoundFALSE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+find_package(SetFoundFALSE CONFIG)
diff --git a/Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake b/Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake
new file mode 100644
index 0000000..ae6bd14
--- /dev/null
+++ b/Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake
@@ -0,0 +1 @@
+set(SetFoundFALSE_FOUND FALSE)
diff --git a/Tests/RunCMake/find_package/SetFoundResolved-stderr.txt b/Tests/RunCMake/find_package/SetFoundResolved-stderr.txt
new file mode 100644
index 0000000..ea94be5
--- /dev/null
+++ b/Tests/RunCMake/find_package/SetFoundResolved-stderr.txt
@@ -0,0 +1,10 @@
+CMake Warning at SetFoundResolved.cmake:10 \(message\):
+ .*/Tests/RunCMake/find_package/symlink
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+
+
+CMake Warning at SetFoundResolved.cmake:15 \(message\):
+ .*/Tests/RunCMake/find_package/PackageRoot
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/find_package/SetFoundResolved.cmake b/Tests/RunCMake/find_package/SetFoundResolved.cmake
new file mode 100644
index 0000000..8d56513
--- /dev/null
+++ b/Tests/RunCMake/find_package/SetFoundResolved.cmake
@@ -0,0 +1,17 @@
+# Create ./symlink pointing back here.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
+ PackageRoot "${CMAKE_CURRENT_SOURCE_DIR}/symlink")
+
+# Make find_package search through the symlink.
+set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/symlink")
+
+# Test preservation of symlinks.
+find_package(Resolved)
+message(WARNING "${Resolved_DIR}")
+
+# Test resolving symlinks.
+set(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS ON)
+find_package(Resolved)
+message(WARNING "${Resolved_DIR}")
+
+file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/symlink")
diff --git a/Tests/RunCMake/find_package/VersionRange.cmake b/Tests/RunCMake/find_package/VersionRange.cmake
new file mode 100644
index 0000000..30b88a8
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionRange.cmake
@@ -0,0 +1,37 @@
+
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
+
+set (VersionRange_SPECIFIED_VERSION_COMPLETE 1.2.3.4...5.6.7.8)
+set (VersionRange_SPECIFIED_VERSION_RANGE 1.2.3.4...5.6.7.8)
+set (VersionRange_SPECIFIED_VERSION_MIN 1.2.3.4)
+set (VersionRange_SPECIFIED_VERSION_MIN_MAJOR 1)
+set (VersionRange_SPECIFIED_VERSION_MIN_MINOR 2)
+set (VersionRange_SPECIFIED_VERSION_MIN_PATCH 3)
+set (VersionRange_SPECIFIED_VERSION_MIN_TWEAK 4)
+set (VersionRange_SPECIFIED_VERSION_MAX 5.6.7.8)
+set (VersionRange_SPECIFIED_VERSION_MAX_MAJOR 5)
+set (VersionRange_SPECIFIED_VERSION_MAX_MINOR 6)
+set (VersionRange_SPECIFIED_VERSION_MAX_PATCH 7)
+set (VersionRange_SPECIFIED_VERSION_MAX_TWEAK 8)
+
+find_package (VersionRange ${VersionRange_SPECIFIED_VERSION_RANGE})
+
+if (NOT VersionRange_FOUND)
+ message (FATAL_ERROR "Package VersionRange not found.")
+endif()
+
+if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5")
+ message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}")
+endif()
+if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2")
+ message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}")
+endif()
+if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3")
+ message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}")
+endif()
+if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4")
+ message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}")
+endif()
+if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5")
+ message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}")
+endif()
diff --git a/Tests/RunCMake/find_package/VersionRange2.cmake b/Tests/RunCMake/find_package/VersionRange2.cmake
new file mode 100644
index 0000000..9adcc64
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionRange2.cmake
@@ -0,0 +1,37 @@
+
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
+
+set (VersionRange_SPECIFIED_VERSION_COMPLETE 1.2.3.4...<5.6.7.8)
+set (VersionRange_SPECIFIED_VERSION_RANGE 1.2.3.4...<5.6.7.8)
+set (VersionRange_SPECIFIED_VERSION_MIN 1.2.3.4)
+set (VersionRange_SPECIFIED_VERSION_MIN_MAJOR 1)
+set (VersionRange_SPECIFIED_VERSION_MIN_MINOR 2)
+set (VersionRange_SPECIFIED_VERSION_MIN_PATCH 3)
+set (VersionRange_SPECIFIED_VERSION_MIN_TWEAK 4)
+set (VersionRange_SPECIFIED_VERSION_MAX 5.6.7.8)
+set (VersionRange_SPECIFIED_VERSION_MAX_MAJOR 5)
+set (VersionRange_SPECIFIED_VERSION_MAX_MINOR 6)
+set (VersionRange_SPECIFIED_VERSION_MAX_PATCH 7)
+set (VersionRange_SPECIFIED_VERSION_MAX_TWEAK 8)
+
+find_package (VersionRange ${VersionRange_SPECIFIED_VERSION_RANGE})
+
+if (NOT VersionRange_FOUND)
+ message (FATAL_ERROR "Package VersionRange not found.")
+endif()
+
+if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5")
+ message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}")
+endif()
+if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2")
+ message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}")
+endif()
+if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3")
+ message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}")
+endif()
+if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4")
+ message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}")
+endif()
+if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5")
+ message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}")
+endif()
diff --git a/Tests/RunCMake/find_package/VersionRange3.cmake b/Tests/RunCMake/find_package/VersionRange3.cmake
new file mode 100644
index 0000000..41efac4
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionRange3.cmake
@@ -0,0 +1,49 @@
+
+# show the effect of the exclusion or inclusion of the upper endpoint
+
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
+
+set (VersionRange_SPECIFIED_VERSION_COMPLETE 1.2.3.4...<2.3.4.5)
+set (VersionRange_SPECIFIED_VERSION_RANGE 1.2.3.4...<2.3.4.5)
+set (VersionRange_SPECIFIED_VERSION_MIN 1.2.3.4)
+set (VersionRange_SPECIFIED_VERSION_MIN_MAJOR 1)
+set (VersionRange_SPECIFIED_VERSION_MIN_MINOR 2)
+set (VersionRange_SPECIFIED_VERSION_MIN_PATCH 3)
+set (VersionRange_SPECIFIED_VERSION_MIN_TWEAK 4)
+set (VersionRange_SPECIFIED_VERSION_MAX 2.3.4.5)
+set (VersionRange_SPECIFIED_VERSION_MAX_MAJOR 2)
+set (VersionRange_SPECIFIED_VERSION_MAX_MINOR 3)
+set (VersionRange_SPECIFIED_VERSION_MAX_PATCH 4)
+set (VersionRange_SPECIFIED_VERSION_MAX_TWEAK 5)
+
+find_package (VersionRange ${VersionRange_SPECIFIED_VERSION_RANGE})
+
+if (VersionRange_FOUND)
+ message (FATAL_ERROR "Package VersionRange found unexpectedly.")
+endif()
+
+
+set (VersionRange_SPECIFIED_VERSION_COMPLETE 1.2.3.4...2.3.4.5)
+set (VersionRange_SPECIFIED_VERSION_RANGE 1.2.3.4...2.3.4.5)
+
+find_package (VersionRange ${VersionRange_SPECIFIED_VERSION_RANGE})
+
+if (NOT VersionRange_FOUND)
+ message (FATAL_ERROR "Package VersionRange not found.")
+endif()
+
+if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5")
+ message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}")
+endif()
+if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2")
+ message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}")
+endif()
+if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3")
+ message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}")
+endif()
+if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4")
+ message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}")
+endif()
+if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5")
+ message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}")
+endif()
diff --git a/Tests/RunCMake/find_package/VersionRange4.cmake b/Tests/RunCMake/find_package/VersionRange4.cmake
new file mode 100644
index 0000000..0953d04
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionRange4.cmake
@@ -0,0 +1,39 @@
+
+# show the effect of the exclusion or inclusion of the upper endpoint
+
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
+
+set (VersionRange_SPECIFIED_VERSION_COMPLETE 2.3.4.5...2.3.4.5)
+set (VersionRange_SPECIFIED_VERSION_RANGE 2.3.4.5...2.3.4.5)
+set (VersionRange_SPECIFIED_VERSION_MIN 2.3.4.5)
+set (VersionRange_SPECIFIED_VERSION_MIN_MAJOR 2)
+set (VersionRange_SPECIFIED_VERSION_MIN_MINOR 3)
+set (VersionRange_SPECIFIED_VERSION_MIN_PATCH 4)
+set (VersionRange_SPECIFIED_VERSION_MIN_TWEAK 5)
+set (VersionRange_SPECIFIED_VERSION_MAX 2.3.4.5)
+set (VersionRange_SPECIFIED_VERSION_MAX_MAJOR 2)
+set (VersionRange_SPECIFIED_VERSION_MAX_MINOR 3)
+set (VersionRange_SPECIFIED_VERSION_MAX_PATCH 4)
+set (VersionRange_SPECIFIED_VERSION_MAX_TWEAK 5)
+
+find_package (VersionRange ${VersionRange_SPECIFIED_VERSION_RANGE})
+
+if (NOT VersionRange_FOUND)
+ message (FATAL_ERROR "Package VersionRange not found.")
+endif()
+
+if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5")
+ message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}")
+endif()
+if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2")
+ message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}")
+endif()
+if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3")
+ message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}")
+endif()
+if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4")
+ message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}")
+endif()
+if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5")
+ message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}")
+endif()
diff --git a/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfig.cmake b/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfig.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfig.cmake
diff --git a/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfigVersion.cmake b/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfigVersion.cmake
new file mode 100644
index 0000000..e9f6076
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfigVersion.cmake
@@ -0,0 +1,74 @@
+
+if (NOT PACKAGE_FIND_VERSION_COMPLETE STREQUAL "1.2.3.4...5.6.7.8"
+ AND NOT PACKAGE_FIND_VERSION_COMPLETE STREQUAL "1.2.3.4...<5.6.7.8")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_COMPLETE: ${PACKAGE_FIND_VERSION_COMPLETE}")
+endif()
+
+if (NOT PACKAGE_FIND_VERSION VERSION_EQUAL "1.2.3.4")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION: ${PACKAGE_FIND_VERSION}")
+endif()
+if (NOT PACKAGE_FIND_VERSION_MAJOR VERSION_EQUAL "1")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAJOR: ${PACKAGE_FIND_VERSION_MAJOR}")
+endif()
+if (NOT PACKAGE_FIND_VERSION_MINOR VERSION_EQUAL "2")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MINOR: ${PACKAGE_FIND_VERSION_MINOR}")
+endif()
+if (NOT PACKAGE_FIND_VERSION_PATCH VERSION_EQUAL "3")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_PATCH: ${PACKAGE_FIND_VERSION_PATCH}")
+endif()
+if (NOT PACKAGE_FIND_VERSION_TWEAK VERSION_EQUAL "4")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_TWEAK: ${PACKAGE_FIND_VERSION_TWEAK}")
+endif()
+
+if (NOT PACKAGE_FIND_VERSION_RANGE STREQUAL "1.2.3.4...5.6.7.8"
+ AND NOT PACKAGE_FIND_VERSION_RANGE STREQUAL "1.2.3.4...<5.6.7.8")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_RANGE: ${PACKAGE_FIND_VERSION_RANGE}")
+endif()
+
+if (NOT PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_RANGE_MIN: ${PACKAGE_FIND_VERSION_RANGE_MIN}")
+endif()
+if (PACKAGE_FIND_VERSION_RANGE MATCHES "<[0-9.]+$")
+ if (NOT PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_RANGE_MAX: ${PACKAGE_FIND_VERSION_RANGE_MAX}")
+ endif()
+else()
+ if (NOT PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_RANGE_MAX: ${PACKAGE_FIND_VERSION_RANGE_MAX}")
+ endif()
+endif()
+
+if (NOT PACKAGE_FIND_VERSION_MIN VERSION_EQUAL "1.2.3.4")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MIN: ${PACKAGE_FIND_VERSION_MIN}")
+endif()
+if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR VERSION_EQUAL "1")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MIN_MAJOR: ${PACKAGE_FIND_VERSION_MIN_MAJOR}")
+endif()
+if (NOT PACKAGE_FIND_VERSION_MIN_MINOR VERSION_EQUAL "2")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MIN_MINOR: ${PACKAGE_FIND_VERSION_MIN_MINOR}")
+endif()
+if (NOT PACKAGE_FIND_VERSION_MIN_PATCH VERSION_EQUAL "3")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MIN_PATCH: ${PACKAGE_FIND_VERSION_MIN_PATCH}")
+endif()
+if (NOT PACKAGE_FIND_VERSION_MIN_TWEAK VERSION_EQUAL "4")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MIN_TWEAK: ${PACKAGE_FIND_VERSION_MIN_TWEAK}")
+endif()
+
+if (NOT PACKAGE_FIND_VERSION_MAX VERSION_EQUAL "5.6.7.8")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAX: ${PACKAGE_FIND_VERSION_MAX}")
+endif()
+if (NOT PACKAGE_FIND_VERSION_MAX_MAJOR VERSION_EQUAL "5")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAX_MAJOR: ${PACKAGE_FIND_VERSION_MAX_MAJOR}")
+endif()
+if (NOT PACKAGE_FIND_VERSION_MAX_MINOR VERSION_EQUAL "6")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAX_MINOR: ${PACKAGE_FIND_VERSION_MAX_MINOR}")
+endif()
+if (NOT PACKAGE_FIND_VERSION_MAX_PATCH VERSION_EQUAL "7")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAXPATCH: ${PACKAGE_FIND_VERSION_MAX_PATCH}")
+endif()
+if (NOT PACKAGE_FIND_VERSION_MAX_TWEAK VERSION_EQUAL "8")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAX_TWEAK: ${PACKAGE_FIND_VERSION_MAX_TWEAK}")
+endif()
+
+set (PACKAGE_VERSION 2.3.4.5)
+set (PACKAGE_VERSION_COMPATIBLE TRUE)
diff --git a/Tests/RunCMake/find_package/VersionRangeConfig.cmake b/Tests/RunCMake/find_package/VersionRangeConfig.cmake
new file mode 100644
index 0000000..b39a966
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionRangeConfig.cmake
@@ -0,0 +1,23 @@
+set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+
+find_package(VersionRange 1.2.3.4...5.6.7.8 CONFIG NAMES VersionRangeCfg)
+
+if (NOT VersionRange_FOUND)
+ message (FATAL_ERROR "Package VersionRange not found in CONFIG mode.")
+endif()
+
+if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5")
+ message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}")
+endif()
+if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2")
+ message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}")
+endif()
+if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3")
+ message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}")
+endif()
+if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4")
+ message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}")
+endif()
+if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5")
+ message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}")
+endif()
diff --git a/Tests/RunCMake/find_package/VersionRangeConfig2.cmake b/Tests/RunCMake/find_package/VersionRangeConfig2.cmake
new file mode 100644
index 0000000..04c570a
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionRangeConfig2.cmake
@@ -0,0 +1,23 @@
+set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+
+find_package(VersionRange 1.2.3.4...<5.6.7.8 CONFIG NAMES VersionRangeCfg)
+
+if (NOT VersionRange_FOUND)
+ message (FATAL_ERROR "Package VersionRange not found in CONFIG mode.")
+endif()
+
+if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5")
+ message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}")
+endif()
+if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2")
+ message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}")
+endif()
+if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3")
+ message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}")
+endif()
+if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4")
+ message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}")
+endif()
+if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5")
+ message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}")
+endif()
diff --git a/Tests/RunCMake/find_package/VersionRangeConfigStd.cmake b/Tests/RunCMake/find_package/VersionRangeConfigStd.cmake
new file mode 100644
index 0000000..3ffc72f
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionRangeConfigStd.cmake
@@ -0,0 +1,23 @@
+set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+
+find_package(VersionRange 1.2.3.4 CONFIG NAMES VersionRangeStd)
+
+if (NOT VersionRange_FOUND)
+ message (FATAL_ERROR "Package VersionRange not found in CONFIG mode.")
+endif()
+
+if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5")
+ message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}")
+endif()
+if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2")
+ message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}")
+endif()
+if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3")
+ message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}")
+endif()
+if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4")
+ message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}")
+endif()
+if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5")
+ message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}")
+endif()
diff --git a/Tests/RunCMake/find_package/VersionRangeConfigStd2.cmake b/Tests/RunCMake/find_package/VersionRangeConfigStd2.cmake
new file mode 100644
index 0000000..8b48828
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionRangeConfigStd2.cmake
@@ -0,0 +1,23 @@
+set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+
+find_package(VersionRange 1.2.3.4...5.6.7.8 CONFIG NAMES VersionRangeStd)
+
+if (NOT VersionRange_FOUND)
+ message (FATAL_ERROR "Package VersionRange not found in CONFIG mode.")
+endif()
+
+if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5")
+ message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}")
+endif()
+if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2")
+ message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}")
+endif()
+if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3")
+ message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}")
+endif()
+if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4")
+ message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}")
+endif()
+if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5")
+ message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}")
+endif()
diff --git a/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfig.cmake b/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfig.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfig.cmake
diff --git a/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfigVersion.cmake b/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfigVersion.cmake
new file mode 100644
index 0000000..6e9151c
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfigVersion.cmake
@@ -0,0 +1,24 @@
+
+if (NOT PACKAGE_FIND_VERSION VERSION_EQUAL "1.2.3.4")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION: ${PACKAGE_FIND_VERSION}")
+endif()
+if (NOT PACKAGE_FIND_VERSION_MAJOR VERSION_EQUAL "1")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAJOR: ${PACKAGE_FIND_VERSION_MAJOR}")
+endif()
+if (NOT PACKAGE_FIND_VERSION_MINOR VERSION_EQUAL "2")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MINOR: ${PACKAGE_FIND_VERSION_MINOR}")
+endif()
+if (NOT PACKAGE_FIND_VERSION_PATCH VERSION_EQUAL "3")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_PATCH: ${PACKAGE_FIND_VERSION_PATCH}")
+endif()
+if (NOT PACKAGE_FIND_VERSION_TWEAK VERSION_EQUAL "4")
+ message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_TWEAK: ${PACKAGE_FIND_VERSION_TWEAK}")
+endif()
+
+set (PACKAGE_VERSION 2.3.4.5)
+
+if (PACKAGE_FIND_VERSION VERSION_LESS_EQUAL PACKAGE_VERSION)
+ set (PACKAGE_VERSION_COMPATIBLE TRUE)
+else()
+ set (PACKAGE_VERSION_UNSUITABLE TRUE)
+endif()
diff --git a/Tests/RunCMake/find_package/VersionRangeWithEXACT-result.txt b/Tests/RunCMake/find_package/VersionRangeWithEXACT-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionRangeWithEXACT-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/VersionRangeWithEXACT-stderr.txt b/Tests/RunCMake/find_package/VersionRangeWithEXACT-stderr.txt
new file mode 100644
index 0000000..6319aee
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionRangeWithEXACT-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at VersionRangeWithEXACT.cmake:[0-9]+ \(find_package\):
+ find_package EXACT cannot be specified with a version range.
diff --git a/Tests/RunCMake/find_package/VersionRangeWithEXACT.cmake b/Tests/RunCMake/find_package/VersionRangeWithEXACT.cmake
new file mode 100644
index 0000000..419c7c5
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionRangeWithEXACT.cmake
@@ -0,0 +1 @@
+find_package(VersionRange 1.2...3.4 EXACT)
diff --git a/Tests/RunCMake/find_package/VersionedA-1/VersionedAConfig.cmake b/Tests/RunCMake/find_package/VersionedA-1/VersionedAConfig.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionedA-1/VersionedAConfig.cmake
diff --git a/Tests/RunCMake/find_package/VersionedA-1/VersionedAConfigVersion.cmake b/Tests/RunCMake/find_package/VersionedA-1/VersionedAConfigVersion.cmake
new file mode 100644
index 0000000..2dbcfb2
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionedA-1/VersionedAConfigVersion.cmake
@@ -0,0 +1,4 @@
+set(PACKAGE_VERSION 1)
+if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1)
+ set(PACKAGE_VERSION_COMPATIBLE 1)
+endif()
diff --git a/Tests/RunCMake/find_package/VersionedA-2/VersionedAConfig.cmake b/Tests/RunCMake/find_package/VersionedA-2/VersionedAConfig.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionedA-2/VersionedAConfig.cmake
diff --git a/Tests/RunCMake/find_package/VersionedA-2/VersionedAConfigVersion.cmake b/Tests/RunCMake/find_package/VersionedA-2/VersionedAConfigVersion.cmake
new file mode 100644
index 0000000..7eb8332
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionedA-2/VersionedAConfigVersion.cmake
@@ -0,0 +1,4 @@
+set(PACKAGE_VERSION 2)
+if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 2)
+ set(PACKAGE_VERSION_COMPATIBLE 1)
+endif()
diff --git a/Tests/RunCMake/find_package/WrongVersion-stderr.txt b/Tests/RunCMake/find_package/WrongVersion-stderr.txt
new file mode 100644
index 0000000..ae9fc4a
--- /dev/null
+++ b/Tests/RunCMake/find_package/WrongVersion-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Warning at WrongVersion.cmake:[0-9]+ \(find_package\):
+ Could not find a configuration file for package "VersionedA" that is
+ compatible with requested version "3".
+
+ The following configuration files were considered but not accepted:
+
+ .*/Tests/RunCMake/find_package/VersionedA-[12]/VersionedAConfig.cmake, version: [12]
+ .*/Tests/RunCMake/find_package/VersionedA-[12]/VersionedAConfig.cmake, version: [12]
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/find_package/WrongVersion.cmake b/Tests/RunCMake/find_package/WrongVersion.cmake
new file mode 100644
index 0000000..5bc711f
--- /dev/null
+++ b/Tests/RunCMake/find_package/WrongVersion.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+find_package(VersionedA 3)
diff --git a/Tests/RunCMake/find_package/WrongVersionConfig-stderr.txt b/Tests/RunCMake/find_package/WrongVersionConfig-stderr.txt
new file mode 100644
index 0000000..1b84233
--- /dev/null
+++ b/Tests/RunCMake/find_package/WrongVersionConfig-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Warning at WrongVersionConfig.cmake:[0-9]+ \(find_package\):
+ Could not find a configuration file for package "VersionedA" that is
+ compatible with requested version "3".
+
+ The following configuration files were considered but not accepted:
+
+ .*/Tests/RunCMake/find_package/VersionedA-[12]/VersionedAConfig.cmake, version: [12]
+ .*/Tests/RunCMake/find_package/VersionedA-[12]/VersionedAConfig.cmake, version: [12]
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/find_package/WrongVersionConfig.cmake b/Tests/RunCMake/find_package/WrongVersionConfig.cmake
new file mode 100644
index 0000000..5bc711f
--- /dev/null
+++ b/Tests/RunCMake/find_package/WrongVersionConfig.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+find_package(VersionedA 3)
diff --git a/Tests/RunCMake/find_package/WrongVersionRange-result.txt b/Tests/RunCMake/find_package/WrongVersionRange-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/find_package/WrongVersionRange-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_package/WrongVersionRange-stderr.txt b/Tests/RunCMake/find_package/WrongVersionRange-stderr.txt
new file mode 100644
index 0000000..fe0b088
--- /dev/null
+++ b/Tests/RunCMake/find_package/WrongVersionRange-stderr.txt
@@ -0,0 +1,28 @@
+CMake Error at WrongVersionRange.cmake:[0-9]+ \(find_package\):
+ find_package called with invalid argument "1\.2\.\.\."
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+
+
+CMake Error at WrongVersionRange.cmake:[0-9]+ \(find_package\):
+ find_package called with invalid argument "\.\.\.1\.2"
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+
+
+CMake Error at WrongVersionRange.cmake:[0-9]+ \(find_package\):
+ find_package called with invalid argument "1\.2\.\.\.\.2\.3"
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+
+
+CMake Error at WrongVersionRange.cmake:[0-9]+ \(find_package\):
+ find_package called with invalid argument "1\.2\.\.\.>2\.3"
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+
+
+CMake Error at WrongVersionRange.cmake:[0-9]+ \(find_package\):
+ find_package called with invalid argument "1\.2>\.\.\.2\.3"
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/find_package/WrongVersionRange.cmake b/Tests/RunCMake/find_package/WrongVersionRange.cmake
new file mode 100644
index 0000000..9851ade
--- /dev/null
+++ b/Tests/RunCMake/find_package/WrongVersionRange.cmake
@@ -0,0 +1,9 @@
+find_package(VersionRange 1.2...)
+
+find_package(VersionRange ...1.2)
+
+find_package(VersionRange 1.2....2.3)
+
+find_package(VersionRange 1.2...>2.3)
+
+find_package(VersionRange 1.2>...2.3)