diff options
author | Alex Neundorf <neundorf@kde.org> | 2012-03-10 15:19:02 (GMT) |
---|---|---|
committer | Alex Neundorf <neundorf@kde.org> | 2012-03-10 15:19:02 (GMT) |
commit | e390f87dd197c18e560fb7381f9dad8d15a31297 (patch) | |
tree | 230010eeb43bddae15a49f7b23d16c42869cb46e /Tests/FindPackageTest | |
parent | 5d1822391765f1466a07884810919c8549556e0a (diff) | |
download | CMake-e390f87dd197c18e560fb7381f9dad8d15a31297.zip CMake-e390f87dd197c18e560fb7381f9dad8d15a31297.tar.gz CMake-e390f87dd197c18e560fb7381f9dad8d15a31297.tar.bz2 |
WriteBasicConfigVersionFile: add test for ExactVersion mode
Alex
Diffstat (limited to 'Tests/FindPackageTest')
-rw-r--r-- | Tests/FindPackageTest/CMakeLists.txt | 70 |
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() |