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 /Modules | |
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 'Modules')
-rw-r--r-- | Modules/FindSWIG.cmake | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake index f732289..87a3894 100644 --- a/Modules/FindSWIG.cmake +++ b/Modules/FindSWIG.cmake @@ -56,8 +56,8 @@ optional Fortran support: #]=======================================================================] # compute list of possible names +unset (_SWIG_NAMES) if (SWIG_FIND_VERSION_RANGE) - set (_SWIG_NAMES) foreach (_SWIG_MAJOR IN ITEMS 4 3 2) if (_SWIG_MAJOR VERSION_GREATER_EQUAL SWIG_FIND_VERSION_MIN_MAJOR AND ((SWIG_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND _SWIG_MAJOR VERSION_LESS_EQUAL SWIG_FIND_VERSION_MAX) @@ -73,10 +73,15 @@ elseif(SWIG_FIND_VERSION) if (_SWIG_MAJOR VERSION_GREATER_EQUAL SWIG_FIND_VERSION_MAJOR) list (APPEND _SWIG_NAMES swig${_SWIG_MAJOR}.0) endif() + endforeach() endif() else() set (_SWIG_NAMES swig4.0 swig3.0 swig2.0) endif() +if (NOT _SWIG_NAMES) + # try to find any version + set (_SWIG_NAMES swig4.0 swig3.0 swig2.0) +endif() find_program(SWIG_EXECUTABLE NAMES ${_SWIG_NAMES} swig) |