summaryrefslogtreecommitdiffstats
path: root/Tests/FindPackageTest
diff options
context:
space:
mode:
authorDaniele E. Domenichelli <ddomenichelli@drdanz.it>2017-11-20 10:09:58 (GMT)
committerDaniele E. Domenichelli <ddomenichelli@drdanz.it>2017-11-21 08:27:07 (GMT)
commit16a93de0a81e913d71f86835b267516ea4875517 (patch)
tree3c07d623379de0754b485601b67a5cceafa938db /Tests/FindPackageTest
parent566f77b7f9747b037b0aed937020e17460b44f23 (diff)
downloadCMake-16a93de0a81e913d71f86835b267516ea4875517.zip
CMake-16a93de0a81e913d71f86835b267516ea4875517.tar.gz
CMake-16a93de0a81e913d71f86835b267516ea4875517.tar.bz2
WriteBasicConfigVersionFile: Add SameMinorVersion COMPATIBILITY option
Diffstat (limited to 'Tests/FindPackageTest')
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt79
1 files changed, 78 insertions, 1 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index 1a6f204..ae3f3a2 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -565,6 +565,84 @@ endif()
#######################
+write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake
+ VERSION 1.2.3.17
+ COMPATIBILITY SameMinorVersion)
+
+unset(PACKAGE_VERSION_UNSUITABLE)
+set(PACKAGE_VERSION_EXACT FALSE)
+set(PACKAGE_FIND_VERSION 2.3.4)
+set(PACKAGE_FIND_VERSION_MAJOR 2)
+set(PACKAGE_FIND_VERSION_MINOR 3)
+include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake)
+if(PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Found Zot123 with version 1.2.3.17, but 2.3.4 was requested !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 0.0.1)
+set(PACKAGE_FIND_VERSION_MAJOR 0)
+set(PACKAGE_FIND_VERSION_MINOR 0)
+include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake)
+if(PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Found Zot123 with version 1.2.3.17, but 0.0.1 was requested !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 1.0.0)
+set(PACKAGE_FIND_VERSION_MAJOR 1)
+set(PACKAGE_FIND_VERSION_MINOR 0)
+include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake)
+if(PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Found Zot123 with version 1.2.3.17 (1.0.0 was requested) !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 1.2.0)
+set(PACKAGE_FIND_VERSION_MAJOR 1)
+set(PACKAGE_FIND_VERSION_MINOR 2)
+include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake)
+if(NOT PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Did not find Zot123 with version 1.2.3.17 (1.2.0 was requested) !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 1.2.3)
+set(PACKAGE_FIND_VERSION_MAJOR 1)
+set(PACKAGE_FIND_VERSION_MINOR 2)
+include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake)
+if(NOT PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Did not find Zot123 with version 1.2.3.17 (1.2.3 was requested) !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+endif()
+
+set(PACKAGE_FIND_VERSION 1.2.3.17)
+set(PACKAGE_FIND_VERSION_MAJOR 1)
+set(PACKAGE_FIND_VERSION_MINOR 2)
+include(${CMAKE_CURRENT_BINARY_DIR}/Zot123ConfigVersion.cmake)
+if(NOT PACKAGE_VERSION_COMPATIBLE)
+ message(SEND_ERROR "Did not find Zot123 with version 1.2.3.17 (1.2.3.17 was requested) !")
+endif()
+if(NOT PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT not set, although it should be !")
+endif()
+
+if(PACKAGE_VERSION_UNSUITABLE)
+ message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE set, but must not be !")
+endif()
+
+#######################
+
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake
VERSION 1.2.3.17
COMPATIBILITY ExactVersion)
@@ -618,7 +696,6 @@ if(PACKAGE_VERSION_EXACT)
message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
endif()
-
set(PACKAGE_FIND_VERSION 1.2.3.17)
set(PACKAGE_VERSION_EXACT FALSE)
set(PACKAGE_VERSION_COMPATIBLE FALSE)