summaryrefslogtreecommitdiffstats
path: root/Tests/FindPackageTest
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-10-03 14:40:07 (GMT)
committerBrad King <brad.king@kitware.com>2008-10-03 14:40:07 (GMT)
commit79e9b7555827ba0afe6e6b7d97c81002685ef519 (patch)
tree7c81ca9aa3ac80651d782a3c1f6444cf0068e70f /Tests/FindPackageTest
parent75f8d5aab7b94987f6da2584e70c87b00b9bce7b (diff)
downloadCMake-79e9b7555827ba0afe6e6b7d97c81002685ef519.zip
CMake-79e9b7555827ba0afe6e6b7d97c81002685ef519.tar.gz
CMake-79e9b7555827ba0afe6e6b7d97c81002685ef519.tar.bz2
ENH: Help recursive find_package calls in modules
These changes teach find_package to behave nicely when invoked recursively inside a find-module for the same package. The module will never be recursively loaded again. Version arguments are automatically forwarded.
Diffstat (limited to 'Tests/FindPackageTest')
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt9
-rw-r--r--Tests/FindPackageTest/FindRecursiveA.cmake1
-rw-r--r--Tests/FindPackageTest/FindRecursiveB.cmake1
-rw-r--r--Tests/FindPackageTest/FindRecursiveC.cmake1
-rw-r--r--Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake1
5 files changed, 13 insertions, 0 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index 1703fe7..62a4dc7 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -38,6 +38,7 @@ SET(PACKAGES
foo Foo Bar TFramework Tframework TApp Tapp Special
VersionedA VersionedB
wibbleA wibbleB
+ RecursiveA RecursiveB RecursiveC
)
FOREACH(p ${PACKAGES})
SET(${p}_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
@@ -65,6 +66,11 @@ LIST(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/A")
FIND_PACKAGE(wibbleA NAMES wibble PATHS B)
FIND_PACKAGE(wibbleB NAMES wibble HINTS B)
+# Look for package with recursive find-modules.
+FIND_PACKAGE(RecursiveA)
+FIND_PACKAGE(RecursiveB 2)
+FIND_PACKAGE(RecursiveC 3.1 EXACT)
+
# Expected locations at which packages should be found.
SET(foo_EXPECTED "lib/foo-1.2/foo-config.cmake")
SET(Foo_EXPECTED "lib/foo-1.2/CMake/FooConfig.cmake")
@@ -82,6 +88,9 @@ SET(VersionedA_EXPECTED "lib/zot-2.0/zot-config.cmake")
SET(VersionedB_EXPECTED "lib/zot-3.1/zot-config.cmake")
SET(wibbleA_EXPECTED "A/wibble-config.cmake")
SET(wibbleB_EXPECTED "B/wibble-config.cmake")
+SET(RecursiveA_EXPECTED "lib/RecursiveA/recursivea-config.cmake")
+SET(RecursiveB_EXPECTED "lib/zot-2.0/zot-config.cmake")
+SET(RecursiveC_EXPECTED "lib/zot-3.1/zot-config.cmake")
# Check the results.
FOREACH(p ${PACKAGES})
diff --git a/Tests/FindPackageTest/FindRecursiveA.cmake b/Tests/FindPackageTest/FindRecursiveA.cmake
new file mode 100644
index 0000000..17d6871
--- /dev/null
+++ b/Tests/FindPackageTest/FindRecursiveA.cmake
@@ -0,0 +1 @@
+FIND_PACKAGE(RecursiveA)
diff --git a/Tests/FindPackageTest/FindRecursiveB.cmake b/Tests/FindPackageTest/FindRecursiveB.cmake
new file mode 100644
index 0000000..c609ab1
--- /dev/null
+++ b/Tests/FindPackageTest/FindRecursiveB.cmake
@@ -0,0 +1 @@
+FIND_PACKAGE(RecursiveB NAMES zot)
diff --git a/Tests/FindPackageTest/FindRecursiveC.cmake b/Tests/FindPackageTest/FindRecursiveC.cmake
new file mode 100644
index 0000000..018cc73
--- /dev/null
+++ b/Tests/FindPackageTest/FindRecursiveC.cmake
@@ -0,0 +1 @@
+FIND_PACKAGE(RecursiveC NAMES zot)
diff --git a/Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake b/Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake
new file mode 100644
index 0000000..deffa57
--- /dev/null
+++ b/Tests/FindPackageTest/lib/RecursiveA/recursivea-config.cmake
@@ -0,0 +1 @@
+# Test config file.