diff options
author | Craig Scott <craig.scott@crascit.com> | 2020-10-02 10:58:01 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-10-02 10:58:13 (GMT) |
commit | 468bcc3291ac3f325b401046b2465d634d8e3947 (patch) | |
tree | 7334d827b38affc5c37d9ecaee333b6e65bfa195 /Tests | |
parent | b3adccc8edbd149e2b390a5a8eb050158517669b (diff) | |
parent | 1d300ee2a9f51e08d4006191e2d50fd5771af202 (diff) | |
download | CMake-468bcc3291ac3f325b401046b2465d634d8e3947.zip CMake-468bcc3291ac3f325b401046b2465d634d8e3947.tar.gz CMake-468bcc3291ac3f325b401046b2465d634d8e3947.tar.bz2 |
Merge topic 'FindSWIG-version-range'
1d300ee2a9 FindSWIG: Add version range support
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5306
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/FindSWIG/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/FindSWIG/version-range.cmake | 30 |
2 files changed, 31 insertions, 0 deletions
diff --git a/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake b/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake index 5f5f7f5..6becc3c 100644 --- a/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake @@ -2,3 +2,4 @@ include(RunCMake) run_cmake(components) run_cmake(missing-components) +run_cmake(version-range) diff --git a/Tests/RunCMake/FindSWIG/version-range.cmake b/Tests/RunCMake/FindSWIG/version-range.cmake new file mode 100644 index 0000000..7ba1134 --- /dev/null +++ b/Tests/RunCMake/FindSWIG/version-range.cmake @@ -0,0 +1,30 @@ +cmake_minimum_required (VERSION 3.18...3.19) + +find_package (SWIG) +if (NOT SWIG_FOUND) + message (FATAL_ERROR "Failed to find SWIG") +endif() + +# clean-up SWIG variables +unset (SWIG_EXECUTABLE CACHE) +unset (SWIG_DIR CACHE) + +## Specify a range including current SWIG version +string (REGEX MATCH "^([0-9]+)" upper_version "${SWIG_VERSION}") +math (EXPR upper_version "${upper_version} + 1") + +find_package (SWIG 1.0...${upper_version}.0) +if (NOT SWIG_FOUND) + message (FATAL_ERROR "Failed to find SWIG with version range 1.0...${upper_version}.0") +endif() + +# clean-up SWIG variables +unset (SWIG_EXECUTABLE CACHE) +unset (SWIG_DIR CACHE) + +## Specify a range excluding current SWIG version +set (range 1.0...<${SWIG_VERSION}) +find_package (SWIG ${range}) +if (SWIG_FOUND) + message (FATAL_ERROR "Unexpectedly find SWIG with version range ${range}") +endif() |