diff options
author | Brad King <brad.king@kitware.com> | 2008-09-10 14:11:48 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-09-10 14:11:48 (GMT) |
commit | 994262e5cc05abfb96da9af38f8d84988405ea5b (patch) | |
tree | 3fe840a4aadc7988608eb9e7491e6908f76b3649 /Tests/FindPackageTest | |
parent | 4eaac32db62f96796fc6bfe09d5cc83ff1b15fe6 (diff) | |
download | CMake-994262e5cc05abfb96da9af38f8d84988405ea5b.zip CMake-994262e5cc05abfb96da9af38f8d84988405ea5b.tar.gz CMake-994262e5cc05abfb96da9af38f8d84988405ea5b.tar.bz2 |
ENH: Improve find_package version numbering
Make the number of version components specified explicitly available.
Set variables for unspecified version components to "0" instead of
leaving them unset. This simplifies version number handling for find-
and config-modules. Also support a fourth "tweak" version component
since some packages use them.
Diffstat (limited to 'Tests/FindPackageTest')
-rw-r--r-- | Tests/FindPackageTest/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/FindPackageTest/FindVersionTestA.cmake | 18 | ||||
-rw-r--r-- | Tests/FindPackageTest/FindVersionTestB.cmake | 12 | ||||
-rw-r--r-- | Tests/FindPackageTest/FindVersionTestC.cmake | 6 | ||||
-rw-r--r-- | Tests/FindPackageTest/FindVersionTestD.cmake | 18 |
5 files changed, 46 insertions, 9 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index f02cd70..a3e24bb 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -27,6 +27,7 @@ LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) FIND_PACKAGE(VersionTestA 1) FIND_PACKAGE(VersionTestB 1.2) FIND_PACKAGE(VersionTestC 1.2.3) +FIND_PACKAGE(VersionTestD 1.2.3.4) #----------------------------------------------------------------------------- diff --git a/Tests/FindPackageTest/FindVersionTestA.cmake b/Tests/FindPackageTest/FindVersionTestA.cmake index eedf371..55c67e2 100644 --- a/Tests/FindPackageTest/FindVersionTestA.cmake +++ b/Tests/FindPackageTest/FindVersionTestA.cmake @@ -4,9 +4,15 @@ ENDIF(NOT "${VersionTestA_FIND_VERSION}" STREQUAL "1") IF(NOT "${VersionTestA_FIND_VERSION_MAJOR}" STREQUAL "1") MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION_MAJOR=${VersionTestA_FIND_VERSION_MAJOR} is not 1") ENDIF(NOT "${VersionTestA_FIND_VERSION_MAJOR}" STREQUAL "1") -IF(DEFINED VersionTestA_FIND_VERSION_MINOR) - MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION_MINOR should not be defined") -ENDIF(DEFINED VersionTestA_FIND_VERSION_MINOR) -IF(DEFINED VersionTestA_FIND_VERSION_PATCH) - MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION_PATCH should not be defined") -ENDIF(DEFINED VersionTestA_FIND_VERSION_PATCH) +IF(NOT "${VersionTestA_FIND_VERSION_MINOR}" STREQUAL "0") + MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION_MINOR=${VersionTestA_FIND_VERSION_MINOR} is not 0") +ENDIF(NOT "${VersionTestA_FIND_VERSION_MINOR}" STREQUAL "0") +IF(NOT "${VersionTestA_FIND_VERSION_PATCH}" STREQUAL "0") + MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION_PATCH=${VersionTestA_FIND_VERSION_PATCH} is not 0") +ENDIF(NOT "${VersionTestA_FIND_VERSION_PATCH}" STREQUAL "0") +IF(NOT "${VersionTestA_FIND_VERSION_TWEAK}" STREQUAL "0") + MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION_TWEAK=${VersionTestA_FIND_VERSION_TWEAK} is not 0") +ENDIF(NOT "${VersionTestA_FIND_VERSION_TWEAK}" STREQUAL "0") +IF(NOT "${VersionTestA_FIND_VERSION_COUNT}" STREQUAL "1") + MESSAGE(SEND_ERROR "VersionTestA_FIND_VERSION_COUNT=${VersionTestA_FIND_VERSION_COUNT} is not 1") +ENDIF(NOT "${VersionTestA_FIND_VERSION_COUNT}" STREQUAL "1") diff --git a/Tests/FindPackageTest/FindVersionTestB.cmake b/Tests/FindPackageTest/FindVersionTestB.cmake index 787d200..03173c6 100644 --- a/Tests/FindPackageTest/FindVersionTestB.cmake +++ b/Tests/FindPackageTest/FindVersionTestB.cmake @@ -7,6 +7,12 @@ ENDIF(NOT "${VersionTestB_FIND_VERSION_MAJOR}" STREQUAL "1") IF(NOT "${VersionTestB_FIND_VERSION_MINOR}" STREQUAL "2") MESSAGE(SEND_ERROR "VersionTestB_FIND_VERSION_MINOR=${VersionTestB_FIND_VERSION_MINOR} is not 2") ENDIF(NOT "${VersionTestB_FIND_VERSION_MINOR}" STREQUAL "2") -IF(DEFINED VersionTestB_FIND_VERSION_PATCH) - MESSAGE(SEND_ERROR "VersionTestB_FIND_VERSION_PATCH should not be defined") -ENDIF(DEFINED VersionTestB_FIND_VERSION_PATCH) +IF(NOT "${VersionTestB_FIND_VERSION_PATCH}" STREQUAL "0") + MESSAGE(SEND_ERROR "VersionTestB_FIND_VERSION_PATCH=${VersionTestB_FIND_VERSION_PATCH} is not 0") +ENDIF(NOT "${VersionTestB_FIND_VERSION_PATCH}" STREQUAL "0") +IF(NOT "${VersionTestB_FIND_VERSION_TWEAK}" STREQUAL "0") + MESSAGE(SEND_ERROR "VersionTestB_FIND_VERSION_TWEAK=${VersionTestB_FIND_VERSION_TWEAK} is not 0") +ENDIF(NOT "${VersionTestB_FIND_VERSION_TWEAK}" STREQUAL "0") +IF(NOT "${VersionTestB_FIND_VERSION_COUNT}" STREQUAL "2") + MESSAGE(SEND_ERROR "VersionTestB_FIND_VERSION_COUNT=${VersionTestB_FIND_VERSION_COUNT} is not 2") +ENDIF(NOT "${VersionTestB_FIND_VERSION_COUNT}" STREQUAL "2") diff --git a/Tests/FindPackageTest/FindVersionTestC.cmake b/Tests/FindPackageTest/FindVersionTestC.cmake index 26ce050..1344cbc 100644 --- a/Tests/FindPackageTest/FindVersionTestC.cmake +++ b/Tests/FindPackageTest/FindVersionTestC.cmake @@ -10,3 +10,9 @@ ENDIF(NOT "${VersionTestC_FIND_VERSION_MINOR}" STREQUAL "2") IF(NOT "${VersionTestC_FIND_VERSION_PATCH}" STREQUAL "3") MESSAGE(SEND_ERROR "VersionTestC_FIND_VERSION_PATCH=${VersionTestC_FIND_VERSION_PATCH} is not 3") ENDIF(NOT "${VersionTestC_FIND_VERSION_PATCH}" STREQUAL "3") +IF(NOT "${VersionTestC_FIND_VERSION_TWEAK}" STREQUAL "0") + MESSAGE(SEND_ERROR "VersionTestC_FIND_VERSION_TWEAK=${VersionTestC_FIND_VERSION_TWEAK} is not 0") +ENDIF(NOT "${VersionTestC_FIND_VERSION_TWEAK}" STREQUAL "0") +IF(NOT "${VersionTestC_FIND_VERSION_COUNT}" STREQUAL "3") + MESSAGE(SEND_ERROR "VersionTestC_FIND_VERSION_COUNT=${VersionTestC_FIND_VERSION_COUNT} is not 3") +ENDIF(NOT "${VersionTestC_FIND_VERSION_COUNT}" STREQUAL "3") diff --git a/Tests/FindPackageTest/FindVersionTestD.cmake b/Tests/FindPackageTest/FindVersionTestD.cmake new file mode 100644 index 0000000..d3e3f50 --- /dev/null +++ b/Tests/FindPackageTest/FindVersionTestD.cmake @@ -0,0 +1,18 @@ +IF(NOT "${VersionTestD_FIND_VERSION}" STREQUAL "1.2.3.4") + MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION=${VersionTestD_FIND_VERSION} is not 1.2.3.4") +ENDIF(NOT "${VersionTestD_FIND_VERSION}" STREQUAL "1.2.3.4") +IF(NOT "${VersionTestD_FIND_VERSION_MAJOR}" STREQUAL "1") + MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION_MAJOR=${VersionTestD_FIND_VERSION_MAJOR} is not 1") +ENDIF(NOT "${VersionTestD_FIND_VERSION_MAJOR}" STREQUAL "1") +IF(NOT "${VersionTestD_FIND_VERSION_MINOR}" STREQUAL "2") + MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION_MINOR=${VersionTestD_FIND_VERSION_MINOR} is not 2") +ENDIF(NOT "${VersionTestD_FIND_VERSION_MINOR}" STREQUAL "2") +IF(NOT "${VersionTestD_FIND_VERSION_PATCH}" STREQUAL "3") + MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION_PATCH=${VersionTestD_FIND_VERSION_PATCH} is not 3") +ENDIF(NOT "${VersionTestD_FIND_VERSION_PATCH}" STREQUAL "3") +IF(NOT "${VersionTestD_FIND_VERSION_TWEAK}" STREQUAL "4") + MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION_TWEAK=${VersionTestD_FIND_VERSION_TWEAK} is not 4") +ENDIF(NOT "${VersionTestD_FIND_VERSION_TWEAK}" STREQUAL "4") +IF(NOT "${VersionTestD_FIND_VERSION_COUNT}" STREQUAL "4") + MESSAGE(SEND_ERROR "VersionTestD_FIND_VERSION_COUNT=${VersionTestD_FIND_VERSION_COUNT} is not 4") +ENDIF(NOT "${VersionTestD_FIND_VERSION_COUNT}" STREQUAL "4") |