summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/find_package/VersionRange.cmake
diff options
context:
space:
mode:
authorMarc Chevier <marc.chevrier@gmail.com>2020-09-22 13:14:13 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2020-09-23 10:52:25 (GMT)
commitd7df81067b3d0dfc476fd3603e7b948a1637edb3 (patch)
treee565c3e5f4bcc1a3f4f25267d82da9530b2c666e /Tests/RunCMake/find_package/VersionRange.cmake
parent09095dbcd2dd43763e37142b65bdaaeb34deb45d (diff)
downloadCMake-d7df81067b3d0dfc476fd3603e7b948a1637edb3.zip
CMake-d7df81067b3d0dfc476fd3603e7b948a1637edb3.tar.gz
CMake-d7df81067b3d0dfc476fd3603e7b948a1637edb3.tar.bz2
find_package: Add support of version range
This enhancement is the first step for solving issue #21107
Diffstat (limited to 'Tests/RunCMake/find_package/VersionRange.cmake')
-rw-r--r--Tests/RunCMake/find_package/VersionRange.cmake32
1 files changed, 32 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_package/VersionRange.cmake b/Tests/RunCMake/find_package/VersionRange.cmake
new file mode 100644
index 0000000..b3d8950
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionRange.cmake
@@ -0,0 +1,32 @@
+
+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_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()