diff options
author | Craig Scott <craig.scott@crascit.com> | 2017-11-22 12:29:09 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-11-22 12:29:33 (GMT) |
commit | 51ccfaacb88303bb2774cead91069e1c25888137 (patch) | |
tree | 54b172cc093017f9c4a049917f8f7deff3871745 /Tests | |
parent | 7dbeb3ac5c7e0985063a5473c98fdbee102f2a4d (diff) | |
parent | d18ff3a5c662a9f5d3b44236ea0084b154f32a9b (diff) | |
download | CMake-51ccfaacb88303bb2774cead91069e1c25888137.zip CMake-51ccfaacb88303bb2774cead91069e1c25888137.tar.gz CMake-51ccfaacb88303bb2774cead91069e1c25888137.tar.bz2 |
Merge topic 'WriteBasicConfigVersionFile_SameMinorVersion'
d18ff3a5 WriteBasicConfigVersionFile: Fix messages in ExactVersion tests
16a93de0 WriteBasicConfigVersionFile: Add SameMinorVersion COMPATIBILITY option
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Claudio <claudio.fantacci@gmail.com>
Merge-request: !1507
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/FindPackageTest/CMakeLists.txt | 91 |
1 files changed, 84 insertions, 7 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 1a6f204..ac3df65 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) @@ -574,7 +652,7 @@ set(PACKAGE_VERSION_EXACT FALSE) set(PACKAGE_FIND_VERSION 2.3.4) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Found Bar123 with version 1.2.3 (2.3.4 was requested) !") + message(SEND_ERROR "Found Bar123 with version 1.2.3.17 (2.3.4 was requested) !") endif() if(PACKAGE_VERSION_EXACT) message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") @@ -583,7 +661,7 @@ endif() set(PACKAGE_FIND_VERSION 1.2) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Found Bar123 with version 1.2.3 (1.2 was requested) !") + message(SEND_ERROR "Found Bar123 with version 1.2.3.17 (1.2 was requested) !") endif() if(PACKAGE_VERSION_EXACT) message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") @@ -592,7 +670,7 @@ endif() set(PACKAGE_FIND_VERSION 1) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Found Bar123 with version 1.2.3 (1 was requested) !") + message(SEND_ERROR "Found Bar123 with version 1.2.3.17 (1 was requested) !") endif() if(PACKAGE_VERSION_EXACT) message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") @@ -601,7 +679,7 @@ endif() set(PACKAGE_FIND_VERSION 1.2.3.4) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(NOT PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3.4 was requested) !") + message(SEND_ERROR "Did not find Bar123 with version 1.2.3.17 (1.2.3.4 was requested) !") endif() if(PACKAGE_VERSION_EXACT) message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !") @@ -612,19 +690,18 @@ set(PACKAGE_VERSION_EXACT FALSE) set(PACKAGE_VERSION_COMPATIBLE FALSE) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(NOT PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3 was requested) !") + message(SEND_ERROR "Did not find Bar123 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_VERSION_EXACT FALSE) set(PACKAGE_VERSION_COMPATIBLE FALSE) include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake) if(NOT PACKAGE_VERSION_COMPATIBLE) - message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3.17 was requested) !") + message(SEND_ERROR "Did not find Bar123 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 !") |