diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-10-02 14:17:36 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2020-10-02 14:17:36 (GMT) |
commit | 127436192de589416e94cbb40190d906a7c57c0a (patch) | |
tree | 5557639d1a6145f53a2fe0c26db8270c630e5276 /Tests/RunCMake/FindSWIG | |
parent | 3ec0f9d6209117e768e3d5c02e5d3cc0dc001a16 (diff) | |
download | CMake-127436192de589416e94cbb40190d906a7c57c0a.zip CMake-127436192de589416e94cbb40190d906a7c57c0a.tar.gz CMake-127436192de589416e94cbb40190d906a7c57c0a.tar.bz2 |
FindSWIG: Fix syntax error
Add some tests to cover all cases regarding version handling
Fixes: #21264
Diffstat (limited to 'Tests/RunCMake/FindSWIG')
-rw-r--r-- | Tests/RunCMake/FindSWIG/RunCMakeTest.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/FindSWIG/version-exact.cmake | 17 | ||||
-rw-r--r-- | Tests/RunCMake/FindSWIG/version.cmake | 6 |
3 files changed, 25 insertions, 0 deletions
diff --git a/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake b/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake index 6becc3c..2bdf913 100644 --- a/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake @@ -2,4 +2,6 @@ include(RunCMake) run_cmake(components) run_cmake(missing-components) +run_cmake(version) +run_cmake(version-exact) run_cmake(version-range) diff --git a/Tests/RunCMake/FindSWIG/version-exact.cmake b/Tests/RunCMake/FindSWIG/version-exact.cmake new file mode 100644 index 0000000..ec3651f --- /dev/null +++ b/Tests/RunCMake/FindSWIG/version-exact.cmake @@ -0,0 +1,17 @@ +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) + +set (version ${SWIG_VERSION}) + +find_package (SWIG ${SWIG_VERSION} EXACT) +if (NOT SWIG_FOUND) + message (FATAL_ERROR "Failed to find SWIG with version ${version} EXACT") +endif() diff --git a/Tests/RunCMake/FindSWIG/version.cmake b/Tests/RunCMake/FindSWIG/version.cmake new file mode 100644 index 0000000..a4f1c39 --- /dev/null +++ b/Tests/RunCMake/FindSWIG/version.cmake @@ -0,0 +1,6 @@ +cmake_minimum_required (VERSION 3.18...3.19) + +find_package (SWIG 1.0) +if (NOT SWIG_FOUND) + message (FATAL_ERROR "Failed to find SWIG with version 1.0") +endif() |