summaryrefslogtreecommitdiff
path: root/Tests/FindPackageTest/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/FindPackageTest/CMakeLists.txt')
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt91
1 files changed, 84 insertions, 7 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index 1a6f20429..ac3df6553 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 !")