[Cmake-commits] [cmake-commits] king committed CMakeLists.txt 1.11 1.12

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Sep 10 11:58:42 EDT 2008


Update of /cvsroot/CMake/CMake/Tests/FindPackageTest
In directory public:/mounts/ram/cvs-serv22756/Tests/FindPackageTest

Modified Files:
	CMakeLists.txt 
Log Message:
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]]]".


Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/FindPackageTest/CMakeLists.txt,v
retrieving revision 1.11
retrieving revision 1.12
diff -C 2 -d -r1.11 -r1.12
*** CMakeLists.txt	10 Sep 2008 14:11:48 -0000	1.11
--- CMakeLists.txt	10 Sep 2008 15:58:40 -0000	1.12
***************
*** 146,147 ****
--- 146,164 ----
      "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()



More information about the Cmake-commits mailing list