WriteBasicConfigVersionFile: add test for ExactVersion mode

Alex
This commit is contained in:
Alex Neundorf 2012-03-10 16:19:02 +01:00
parent 5d18223917
commit e390f87dd1
1 changed files with 70 additions and 0 deletions

View File

@ -421,3 +421,73 @@ endif()
if(PACKAGE_VERSION_UNSUITABLE) if(PACKAGE_VERSION_UNSUITABLE)
message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE set, but must not be !") message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE set, but must not be !")
endif() 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()