diff options
Diffstat (limited to 'Tests')
19 files changed, 431 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_package/FindVersionRange.cmake b/Tests/RunCMake/find_package/FindVersionRange.cmake new file mode 100644 index 0000000..ff84e93 --- /dev/null +++ b/Tests/RunCMake/find_package/FindVersionRange.cmake @@ -0,0 +1,82 @@ + +if (NOT VersionRange_FIND_VERSION_COMPLETE STREQUAL VersionRange_SPECIFIED_VERSION_COMPLETE) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_COMPLETE: ${VersionRange_FIND_VERSION_COMPLETE}") +endif() + +if (NOT VersionRange_FIND_VERSION VERSION_EQUAL "1.2.3.4") + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION: ${VersionRange_FIND_VERSION}") +endif() +if (NOT VersionRange_FIND_VERSION_MAJOR VERSION_EQUAL "1") + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MAJOR: ${VersionRange_FIND_VERSION_MAJOR}") +endif() +if (NOT VersionRange_FIND_VERSION_MINOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MINOR: ${VersionRange_FIND_VERSION_MINOR}") +endif() +if (NOT VersionRange_FIND_VERSION_PATCH VERSION_EQUAL "3") + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_PATCH: ${VersionRange_FIND_VERSION_PATCH}") +endif() +if (NOT VersionRange_FIND_VERSION_TWEAK VERSION_EQUAL "4") + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_TWEAK: ${VersionRange_FIND_VERSION_TWEAK}") +endif() + +if (NOT VersionRange_FIND_VERSION_RANGE STREQUAL VersionRange_SPECIFIED_VERSION_RANGE) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_RANGE: ${VersionRange_FIND_VERSION_RANGE}") +endif() +if (NOT VersionRange_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE") + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_RANGE_MIN: ${VersionRange_FIND_VERSION_RANGE_MIN}") +endif() +if (VersionRange_FIND_VERSION_RANGE MATCHES "<[0-9.]+$") + if (NOT VersionRange_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE") + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_RANGE_MAX: ${VersionRange_FIND_VERSION_RANGE_MAX}") + endif() +else() + if (NOT VersionRange_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE") + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_RANGE_MAX: ${VersionRange_FIND_VERSION_RANGE_MAX}") + endif() +endif() + +if (NOT VersionRange_FIND_VERSION_MIN VERSION_EQUAL "1.2.3.4") + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MIN: ${VersionRange_FIND_VERSION}") +endif() +if (NOT VersionRange_FIND_VERSION_MIN_MAJOR VERSION_EQUAL "1") + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MIN_MAJOR: ${VersionRange_FIND_VERSION_MIN_MAJOR}") +endif() +if (NOT VersionRange_FIND_VERSION_MIN_MINOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MIN_MINOR: ${VersionRange_FIND_VERSION_MIN_MINOR}") +endif() +if (NOT VersionRange_FIND_VERSION_MIN_PATCH VERSION_EQUAL "3") + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MIN_PATCH: ${VersionRange_FIND_VERSION_MIN_PATCH}") +endif() +if (NOT VersionRange_FIND_VERSION_MIN_TWEAK VERSION_EQUAL "4") + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MIN_TWEAK: ${VersionRange_FIND_VERSION_MIN_TWEAK}") +endif() + +if (NOT VersionRange_FIND_VERSION_MAX VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MAX) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MAX: ${VersionRange_FIND_VERSION_MAX}") +endif() +if (NOT VersionRange_FIND_VERSION_MAX_MAJOR VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MAX_MAJOR) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MAX_MAJOR: ${VersionRange_FIND_VERSION_MAX_MAJOR}") +endif() +if (NOT VersionRange_FIND_VERSION_MAX_MINOR VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MAX_MINOR) + message (SEND_ERROR "Wrong value for VersionRange_FIND_VERSION_MAX_MINOR: ${VersionRange_FIND_VERSION_MAX_MINOR}") +endif() +if (NOT VersionRange_FIND_VERSION_MAX_PATCH VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MAX_PATCH) + message (SEND_ERROR "Wrong value for VersionRange_VERSION_FIND_MAX_PATCH: ${VersionRange_FIND_VERSION_MAX_PATCH}") +endif() +if (NOT VersionRange_FIND_VERSION_MAX_TWEAK VERSION_EQUAL VersionRange_SPECIFIED_VERSION_MAX_TWEAK) + message (SEND_ERROR "Wrong value for VersionRange_VERSION_FIND_MAX_TWEAK: ${VersionRange_FIND_VERSION_MAX_TWEAK}") +endif() + +if ((VersionRange_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" + AND "2.3.4.5" VERSION_LESS_EQUAL VersionRange_FIND_VERSION_MAX) + OR (VersionRange_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" + AND "2.3.4.5" VERSION_LESS VersionRange_FIND_VERSION_MAX)) +set (VersionRange_FOUND TRUE) +set (VersionRange_VERSION 2.3.4.5) +set (VersionRange_VERSION_MAJOR 2) +set (VersionRange_VERSION_MINOR 3) +set (VersionRange_VERSION_PATCH 4) +set (VersionRange_VERSION_TWEAK 5) +else() + set (VersionRange_FOUND FALSE) +endif() diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index 5186297..7755a70 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -29,6 +29,15 @@ run_cmake(WrongVersionConfig) run_cmake(CMP0084-OLD) run_cmake(CMP0084-WARN) run_cmake(CMP0084-NEW) +run_cmake(WrongVersionRange) +run_cmake(VersionRangeWithEXACT) +run_cmake(VersionRange) +run_cmake(VersionRange2) +run_cmake(VersionRange3) +run_cmake(VersionRangeConfig) +run_cmake(VersionRangeConfig2) +run_cmake(VersionRangeConfigStd) +run_cmake(VersionRangeConfigStd2) if(UNIX) run_cmake(SetFoundResolved) endif() diff --git a/Tests/RunCMake/find_package/VersionRange.cmake b/Tests/RunCMake/find_package/VersionRange.cmake new file mode 100644 index 0000000..b3d8950 --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRange.cmake @@ -0,0 +1,32 @@ + +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") + +set (VersionRange_SPECIFIED_VERSION_COMPLETE 1.2.3.4...5.6.7.8) +set (VersionRange_SPECIFIED_VERSION_RANGE 1.2.3.4...5.6.7.8) +set (VersionRange_SPECIFIED_VERSION_MAX 5.6.7.8) +set (VersionRange_SPECIFIED_VERSION_MAX_MAJOR 5) +set (VersionRange_SPECIFIED_VERSION_MAX_MINOR 6) +set (VersionRange_SPECIFIED_VERSION_MAX_PATCH 7) +set (VersionRange_SPECIFIED_VERSION_MAX_TWEAK 8) + +find_package (VersionRange ${VersionRange_SPECIFIED_VERSION_RANGE}) + +if (NOT VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange not found.") +endif() + +if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5") + message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}") +endif() +if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}") +endif() +if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3") + message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}") +endif() +if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4") + message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}") +endif() +if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5") + message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}") +endif() diff --git a/Tests/RunCMake/find_package/VersionRange2.cmake b/Tests/RunCMake/find_package/VersionRange2.cmake new file mode 100644 index 0000000..d0e685b --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRange2.cmake @@ -0,0 +1,32 @@ + +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") + +set (VersionRange_SPECIFIED_VERSION_COMPLETE 1.2.3.4...<5.6.7.8) +set (VersionRange_SPECIFIED_VERSION_RANGE 1.2.3.4...<5.6.7.8) +set (VersionRange_SPECIFIED_VERSION_MAX 5.6.7.8) +set (VersionRange_SPECIFIED_VERSION_MAX_MAJOR 5) +set (VersionRange_SPECIFIED_VERSION_MAX_MINOR 6) +set (VersionRange_SPECIFIED_VERSION_MAX_PATCH 7) +set (VersionRange_SPECIFIED_VERSION_MAX_TWEAK 8) + +find_package (VersionRange ${VersionRange_SPECIFIED_VERSION_RANGE}) + +if (NOT VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange not found.") +endif() + +if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5") + message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}") +endif() +if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}") +endif() +if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3") + message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}") +endif() +if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4") + message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}") +endif() +if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5") + message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}") +endif() diff --git a/Tests/RunCMake/find_package/VersionRange3.cmake b/Tests/RunCMake/find_package/VersionRange3.cmake new file mode 100644 index 0000000..76eef1d --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRange3.cmake @@ -0,0 +1,44 @@ + +# show the effect of the exclusion or inclusion of the upper endpoint + +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") + +set (VersionRange_SPECIFIED_VERSION_COMPLETE 1.2.3.4...<2.3.4.5) +set (VersionRange_SPECIFIED_VERSION_RANGE 1.2.3.4...<2.3.4.5) +set (VersionRange_SPECIFIED_VERSION_MAX 2.3.4.5) +set (VersionRange_SPECIFIED_VERSION_MAX_MAJOR 2) +set (VersionRange_SPECIFIED_VERSION_MAX_MINOR 3) +set (VersionRange_SPECIFIED_VERSION_MAX_PATCH 4) +set (VersionRange_SPECIFIED_VERSION_MAX_TWEAK 5) + +find_package (VersionRange ${VersionRange_SPECIFIED_VERSION_RANGE}) + +if (VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange found unexpectedly.") +endif() + + +set (VersionRange_SPECIFIED_VERSION_COMPLETE 1.2.3.4...2.3.4.5) +set (VersionRange_SPECIFIED_VERSION_RANGE 1.2.3.4...2.3.4.5) + +find_package (VersionRange ${VersionRange_SPECIFIED_VERSION_RANGE}) + +if (NOT VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange not found.") +endif() + +if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5") + message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}") +endif() +if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}") +endif() +if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3") + message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}") +endif() +if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4") + message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}") +endif() +if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5") + message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}") +endif() diff --git a/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfig.cmake b/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfig.cmake diff --git a/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfigVersion.cmake b/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfigVersion.cmake new file mode 100644 index 0000000..e9f6076 --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeCfg/VersionRangeCfgConfigVersion.cmake @@ -0,0 +1,74 @@ + +if (NOT PACKAGE_FIND_VERSION_COMPLETE STREQUAL "1.2.3.4...5.6.7.8" + AND NOT PACKAGE_FIND_VERSION_COMPLETE STREQUAL "1.2.3.4...<5.6.7.8") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_COMPLETE: ${PACKAGE_FIND_VERSION_COMPLETE}") +endif() + +if (NOT PACKAGE_FIND_VERSION VERSION_EQUAL "1.2.3.4") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION: ${PACKAGE_FIND_VERSION}") +endif() +if (NOT PACKAGE_FIND_VERSION_MAJOR VERSION_EQUAL "1") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAJOR: ${PACKAGE_FIND_VERSION_MAJOR}") +endif() +if (NOT PACKAGE_FIND_VERSION_MINOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MINOR: ${PACKAGE_FIND_VERSION_MINOR}") +endif() +if (NOT PACKAGE_FIND_VERSION_PATCH VERSION_EQUAL "3") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_PATCH: ${PACKAGE_FIND_VERSION_PATCH}") +endif() +if (NOT PACKAGE_FIND_VERSION_TWEAK VERSION_EQUAL "4") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_TWEAK: ${PACKAGE_FIND_VERSION_TWEAK}") +endif() + +if (NOT PACKAGE_FIND_VERSION_RANGE STREQUAL "1.2.3.4...5.6.7.8" + AND NOT PACKAGE_FIND_VERSION_RANGE STREQUAL "1.2.3.4...<5.6.7.8") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_RANGE: ${PACKAGE_FIND_VERSION_RANGE}") +endif() + +if (NOT PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_RANGE_MIN: ${PACKAGE_FIND_VERSION_RANGE_MIN}") +endif() +if (PACKAGE_FIND_VERSION_RANGE MATCHES "<[0-9.]+$") + if (NOT PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_RANGE_MAX: ${PACKAGE_FIND_VERSION_RANGE_MAX}") + endif() +else() + if (NOT PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_RANGE_MAX: ${PACKAGE_FIND_VERSION_RANGE_MAX}") + endif() +endif() + +if (NOT PACKAGE_FIND_VERSION_MIN VERSION_EQUAL "1.2.3.4") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MIN: ${PACKAGE_FIND_VERSION_MIN}") +endif() +if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR VERSION_EQUAL "1") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MIN_MAJOR: ${PACKAGE_FIND_VERSION_MIN_MAJOR}") +endif() +if (NOT PACKAGE_FIND_VERSION_MIN_MINOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MIN_MINOR: ${PACKAGE_FIND_VERSION_MIN_MINOR}") +endif() +if (NOT PACKAGE_FIND_VERSION_MIN_PATCH VERSION_EQUAL "3") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MIN_PATCH: ${PACKAGE_FIND_VERSION_MIN_PATCH}") +endif() +if (NOT PACKAGE_FIND_VERSION_MIN_TWEAK VERSION_EQUAL "4") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MIN_TWEAK: ${PACKAGE_FIND_VERSION_MIN_TWEAK}") +endif() + +if (NOT PACKAGE_FIND_VERSION_MAX VERSION_EQUAL "5.6.7.8") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAX: ${PACKAGE_FIND_VERSION_MAX}") +endif() +if (NOT PACKAGE_FIND_VERSION_MAX_MAJOR VERSION_EQUAL "5") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAX_MAJOR: ${PACKAGE_FIND_VERSION_MAX_MAJOR}") +endif() +if (NOT PACKAGE_FIND_VERSION_MAX_MINOR VERSION_EQUAL "6") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAX_MINOR: ${PACKAGE_FIND_VERSION_MAX_MINOR}") +endif() +if (NOT PACKAGE_FIND_VERSION_MAX_PATCH VERSION_EQUAL "7") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAXPATCH: ${PACKAGE_FIND_VERSION_MAX_PATCH}") +endif() +if (NOT PACKAGE_FIND_VERSION_MAX_TWEAK VERSION_EQUAL "8") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAX_TWEAK: ${PACKAGE_FIND_VERSION_MAX_TWEAK}") +endif() + +set (PACKAGE_VERSION 2.3.4.5) +set (PACKAGE_VERSION_COMPATIBLE TRUE) diff --git a/Tests/RunCMake/find_package/VersionRangeConfig.cmake b/Tests/RunCMake/find_package/VersionRangeConfig.cmake new file mode 100644 index 0000000..b39a966 --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeConfig.cmake @@ -0,0 +1,23 @@ +set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + +find_package(VersionRange 1.2.3.4...5.6.7.8 CONFIG NAMES VersionRangeCfg) + +if (NOT VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange not found in CONFIG mode.") +endif() + +if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5") + message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}") +endif() +if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}") +endif() +if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3") + message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}") +endif() +if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4") + message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}") +endif() +if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5") + message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}") +endif() diff --git a/Tests/RunCMake/find_package/VersionRangeConfig2.cmake b/Tests/RunCMake/find_package/VersionRangeConfig2.cmake new file mode 100644 index 0000000..04c570a --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeConfig2.cmake @@ -0,0 +1,23 @@ +set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + +find_package(VersionRange 1.2.3.4...<5.6.7.8 CONFIG NAMES VersionRangeCfg) + +if (NOT VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange not found in CONFIG mode.") +endif() + +if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5") + message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}") +endif() +if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}") +endif() +if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3") + message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}") +endif() +if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4") + message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}") +endif() +if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5") + message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}") +endif() diff --git a/Tests/RunCMake/find_package/VersionRangeConfigStd.cmake b/Tests/RunCMake/find_package/VersionRangeConfigStd.cmake new file mode 100644 index 0000000..3ffc72f --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeConfigStd.cmake @@ -0,0 +1,23 @@ +set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + +find_package(VersionRange 1.2.3.4 CONFIG NAMES VersionRangeStd) + +if (NOT VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange not found in CONFIG mode.") +endif() + +if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5") + message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}") +endif() +if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}") +endif() +if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3") + message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}") +endif() +if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4") + message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}") +endif() +if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5") + message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}") +endif() diff --git a/Tests/RunCMake/find_package/VersionRangeConfigStd2.cmake b/Tests/RunCMake/find_package/VersionRangeConfigStd2.cmake new file mode 100644 index 0000000..8b48828 --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeConfigStd2.cmake @@ -0,0 +1,23 @@ +set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + +find_package(VersionRange 1.2.3.4...5.6.7.8 CONFIG NAMES VersionRangeStd) + +if (NOT VersionRange_FOUND) + message (FATAL_ERROR "Package VersionRange not found in CONFIG mode.") +endif() + +if (NOT VersionRange_VERSION VERSION_EQUAL "2.3.4.5") + message (SEND_ERROR "Wrong version : ${VersionRange_VERSION}") +endif() +if (NOT VersionRange_VERSION_MAJOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong major version : ${VersionRange_VERSION_MAJOR}") +endif() +if (NOT VersionRange_VERSION_MINOR VERSION_EQUAL "3") + message (SEND_ERROR "Wrong minor version : ${VersionRange_VERSION_MINOR}") +endif() +if (NOT VersionRange_VERSION_PATCH VERSION_EQUAL "4") + message (SEND_ERROR "Wrong patch version : ${VersionRange_VERSION_PATCH}") +endif() +if (NOT VersionRange_VERSION_TWEAK VERSION_EQUAL "5") + message (SEND_ERROR "Wrong tweak version : ${VersionRange_VERSION_TWEAK}") +endif() diff --git a/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfig.cmake b/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfig.cmake diff --git a/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfigVersion.cmake b/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfigVersion.cmake new file mode 100644 index 0000000..6e9151c --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeStd/VersionRangeStdConfigVersion.cmake @@ -0,0 +1,24 @@ + +if (NOT PACKAGE_FIND_VERSION VERSION_EQUAL "1.2.3.4") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION: ${PACKAGE_FIND_VERSION}") +endif() +if (NOT PACKAGE_FIND_VERSION_MAJOR VERSION_EQUAL "1") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MAJOR: ${PACKAGE_FIND_VERSION_MAJOR}") +endif() +if (NOT PACKAGE_FIND_VERSION_MINOR VERSION_EQUAL "2") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_MINOR: ${PACKAGE_FIND_VERSION_MINOR}") +endif() +if (NOT PACKAGE_FIND_VERSION_PATCH VERSION_EQUAL "3") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_PATCH: ${PACKAGE_FIND_VERSION_PATCH}") +endif() +if (NOT PACKAGE_FIND_VERSION_TWEAK VERSION_EQUAL "4") + message (SEND_ERROR "Wrong value for PACKAGE_FIND_VERSION_TWEAK: ${PACKAGE_FIND_VERSION_TWEAK}") +endif() + +set (PACKAGE_VERSION 2.3.4.5) + +if (PACKAGE_FIND_VERSION VERSION_LESS_EQUAL PACKAGE_VERSION) + set (PACKAGE_VERSION_COMPATIBLE TRUE) +else() + set (PACKAGE_VERSION_UNSUITABLE TRUE) +endif() diff --git a/Tests/RunCMake/find_package/VersionRangeWithEXACT-result.txt b/Tests/RunCMake/find_package/VersionRangeWithEXACT-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeWithEXACT-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_package/VersionRangeWithEXACT-stderr.txt b/Tests/RunCMake/find_package/VersionRangeWithEXACT-stderr.txt new file mode 100644 index 0000000..6319aee --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeWithEXACT-stderr.txt @@ -0,0 +1,2 @@ +CMake Error at VersionRangeWithEXACT.cmake:[0-9]+ \(find_package\): + find_package EXACT cannot be specified with a version range. diff --git a/Tests/RunCMake/find_package/VersionRangeWithEXACT.cmake b/Tests/RunCMake/find_package/VersionRangeWithEXACT.cmake new file mode 100644 index 0000000..419c7c5 --- /dev/null +++ b/Tests/RunCMake/find_package/VersionRangeWithEXACT.cmake @@ -0,0 +1 @@ +find_package(VersionRange 1.2...3.4 EXACT) diff --git a/Tests/RunCMake/find_package/WrongVersionRange-result.txt b/Tests/RunCMake/find_package/WrongVersionRange-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/find_package/WrongVersionRange-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/find_package/WrongVersionRange-stderr.txt b/Tests/RunCMake/find_package/WrongVersionRange-stderr.txt new file mode 100644 index 0000000..fe0b088 --- /dev/null +++ b/Tests/RunCMake/find_package/WrongVersionRange-stderr.txt @@ -0,0 +1,28 @@ +CMake Error at WrongVersionRange.cmake:[0-9]+ \(find_package\): + find_package called with invalid argument "1\.2\.\.\." +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at WrongVersionRange.cmake:[0-9]+ \(find_package\): + find_package called with invalid argument "\.\.\.1\.2" +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at WrongVersionRange.cmake:[0-9]+ \(find_package\): + find_package called with invalid argument "1\.2\.\.\.\.2\.3" +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at WrongVersionRange.cmake:[0-9]+ \(find_package\): + find_package called with invalid argument "1\.2\.\.\.>2\.3" +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) + + +CMake Error at WrongVersionRange.cmake:[0-9]+ \(find_package\): + find_package called with invalid argument "1\.2>\.\.\.2\.3" +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/find_package/WrongVersionRange.cmake b/Tests/RunCMake/find_package/WrongVersionRange.cmake new file mode 100644 index 0000000..9851ade --- /dev/null +++ b/Tests/RunCMake/find_package/WrongVersionRange.cmake @@ -0,0 +1,9 @@ +find_package(VersionRange 1.2...) + +find_package(VersionRange ...1.2) + +find_package(VersionRange 1.2....2.3) + +find_package(VersionRange 1.2...>2.3) + +find_package(VersionRange 1.2>...2.3) |