summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-03-13 15:54:33 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-03-13 15:54:33 (GMT)
commit6452aea231f529e03ba41ed611832de352babd9f (patch)
treedd53b9b1eeec4f4d48d5aa69d92b76b0246dad7e /Tests
parent15e96b0304f912bae3cfcde7a1b3d6ae3660ef9e (diff)
parente390f87dd197c18e560fb7381f9dad8d15a31297 (diff)
downloadCMake-6452aea231f529e03ba41ed611832de352babd9f.zip
CMake-6452aea231f529e03ba41ed611832de352babd9f.tar.gz
CMake-6452aea231f529e03ba41ed611832de352babd9f.tar.bz2
Merge topic 'ExactVersionModeForVersionFile'
e390f87 WriteBasicConfigVersionFile: add test for ExactVersion mode 5d18223 write_basic_package_version_file: add ExactVersion mode 1c69cd8 write_basic_package_version_file(): improve documentation
Diffstat (limited to 'Tests')
-rw-r--r--Tests/FindPackageTest/CMakeLists.txt70
1 files changed, 70 insertions, 0 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index a4f213b..73f24e0 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -421,3 +421,73 @@ 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)
+
+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) !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+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) !")
+endif()
+if(PACKAGE_VERSION_EXACT)
+ message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
+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) !")
+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.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) !")
+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_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) !")
+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) !")
+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()