summaryrefslogtreecommitdiffstats
path: root/Tests/FindPackageTest/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-09-10 15:58:40 (GMT)
committerBrad King <brad.king@kitware.com>2008-09-10 15:58:40 (GMT)
commit4fa96dbf95bb3689fb1c3283c38713ec5275f262 (patch)
treefdf7858be3ec641926a37794ed4e8d906f2e3b52 /Tests/FindPackageTest/CMakeLists.txt
parent4ed4f5a7d4e399b9ac247aff7fec7cda61bfb5d1 (diff)
downloadCMake-4fa96dbf95bb3689fb1c3283c38713ec5275f262.zip
CMake-4fa96dbf95bb3689fb1c3283c38713ec5275f262.tar.gz
CMake-4fa96dbf95bb3689fb1c3283c38713ec5275f262.tar.bz2
ENH: Add version comparison to if() command
Provide VERSION_LESS, VERSION_EQUAL, and VERSION_GREATER operators in the if() command. This simplifies component-wise comparison of version numbers in the form "major[.minor[.patch[.tweak]]]".
Diffstat (limited to 'Tests/FindPackageTest/CMakeLists.txt')
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt17
1 files changed, 17 insertions, 0 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index a3e24bb..1703fe7 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -145,3 +145,20 @@ IF(NOT "${Special_VERSION_MINOR}" STREQUAL "2")
MESSAGE(SEND_ERROR
"Package Special is minor version [${Special_VERSION_MINOR}], not [2]")
ENDIF(NOT "${Special_VERSION_MINOR}" STREQUAL "2")
+
+# Test version number comparison.
+IF(NOT "1.2.3.4" VERSION_LESS "1.2.3.5")
+ MESSAGE(SEND_ERROR "1.2.3.4 VERSION_LESS 1.2.3.5 is not true!")
+ENDIF()
+IF(NOT "1.2" VERSION_LESS "1.10")
+ MESSAGE(SEND_ERROR "1.2 VERSION_LESS 1.10 is not true!")
+ENDIF()
+IF(NOT "1.02" VERSION_GREATER "1.1")
+ MESSAGE(SEND_ERROR "1.02 VERSION_GREATER 1.1 is not true!")
+ENDIF()
+IF("1.2.3" VERSION_GREATER "1.2.3.4")
+ MESSAGE(SEND_ERROR "1.2.3 VERSION_GREATER 1.2.3.4 is not false!")
+ENDIF()
+IF(NOT "1.2" VERSION_EQUAL "1.2.0.0")
+ MESSAGE(SEND_ERROR "1.2 VERSION_EQUAL 1.2.0.0 is not true!")
+ENDIF()