summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/find_dependency/share
diff options
context:
space:
mode:
authorMatthew Woehlke <matthew.woehlke@kitware.com>2017-05-22 17:32:43 (GMT)
committerMatthew Woehlke <matthew.woehlke@kitware.com>2017-05-22 17:32:43 (GMT)
commitab358d6a859d8b7e257ed1e06ca000e097a32ef6 (patch)
tree19e96ec3a96ef3a0415b8c5e68571d7a392aee89 /Tests/RunCMake/find_dependency/share
parentde41f3b38c0d5e8d7045cd5e6e96eef72c388d5b (diff)
downloadCMake-ab358d6a859d8b7e257ed1e06ca000e097a32ef6.zip
CMake-ab358d6a859d8b7e257ed1e06ca000e097a32ef6.tar.gz
CMake-ab358d6a859d8b7e257ed1e06ca000e097a32ef6.tar.bz2
Improve find_dependency argument handling
Remove highly specialized and totally positional argument handling in find_dependency macro, and instead just pass arguments through to find_package. This gives users access to the full suite of arguments that find_package knows, and is backward compatible with the old arguments. Also, rewrite the unit tests for this, since the old tests are exclusively focused on testing the old argument handling and are no longer applicable, and add some success tests (the old tests did not even set up the CMake state in a way that CMake had any hope of ever finding the test package).
Diffstat (limited to 'Tests/RunCMake/find_dependency/share')
-rw-r--r--Tests/RunCMake/find_dependency/share/cmake/Pack1/Pack1Config.cmake2
-rw-r--r--Tests/RunCMake/find_dependency/share/cmake/Pack1/Pack1ConfigVersion.cmake11
-rw-r--r--Tests/RunCMake/find_dependency/share/cmake/Pack2/Pack2Config.cmake6
-rw-r--r--Tests/RunCMake/find_dependency/share/cmake/Pack2/Pack2ConfigVersion.cmake11
4 files changed, 30 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_dependency/share/cmake/Pack1/Pack1Config.cmake b/Tests/RunCMake/find_dependency/share/cmake/Pack1/Pack1Config.cmake
new file mode 100644
index 0000000..7d55ef6
--- /dev/null
+++ b/Tests/RunCMake/find_dependency/share/cmake/Pack1/Pack1Config.cmake
@@ -0,0 +1,2 @@
+
+add_library(Pack1::Lib INTERFACE IMPORTED)
diff --git a/Tests/RunCMake/find_dependency/share/cmake/Pack1/Pack1ConfigVersion.cmake b/Tests/RunCMake/find_dependency/share/cmake/Pack1/Pack1ConfigVersion.cmake
new file mode 100644
index 0000000..dfb7b6c
--- /dev/null
+++ b/Tests/RunCMake/find_dependency/share/cmake/Pack1/Pack1ConfigVersion.cmake
@@ -0,0 +1,11 @@
+
+set(PACKAGE_VERSION "1.3")
+
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
+ if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
+ set(PACKAGE_VERSION_EXACT TRUE)
+ endif()
+endif()
diff --git a/Tests/RunCMake/find_dependency/share/cmake/Pack2/Pack2Config.cmake b/Tests/RunCMake/find_dependency/share/cmake/Pack2/Pack2Config.cmake
new file mode 100644
index 0000000..7e8a60b
--- /dev/null
+++ b/Tests/RunCMake/find_dependency/share/cmake/Pack2/Pack2Config.cmake
@@ -0,0 +1,6 @@
+include(CMakeFindDependencyMacro)
+
+find_dependency(Pack1 PATHS ${CMAKE_CURRENT_LIST_DIR}/..)
+
+add_library(Pack2::Lib INTERFACE IMPORTED)
+set_target_properties(Pack2::Lib PROPERTIES INTERFACE_LINK_LIBRARIES Pack1::Lib)
diff --git a/Tests/RunCMake/find_dependency/share/cmake/Pack2/Pack2ConfigVersion.cmake b/Tests/RunCMake/find_dependency/share/cmake/Pack2/Pack2ConfigVersion.cmake
new file mode 100644
index 0000000..dfb7b6c
--- /dev/null
+++ b/Tests/RunCMake/find_dependency/share/cmake/Pack2/Pack2ConfigVersion.cmake
@@ -0,0 +1,11 @@
+
+set(PACKAGE_VERSION "1.3")
+
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
+ if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
+ set(PACKAGE_VERSION_EXACT TRUE)
+ endif()
+endif()