diff options
author | Michael Hirsch <scivision@users.noreply.gitlab.kitware.com> | 2022-03-07 01:04:59 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-03-07 15:12:43 (GMT) |
commit | bb2c7b7dc05c15ac929db54a3c5931ddab4867a3 (patch) | |
tree | f2aa306ee90d3086fd902fdf318585e9ea431087 | |
parent | 6e9eaf209dada6be84c1ac24e641c962fd40bae2 (diff) | |
download | CMake-bb2c7b7dc05c15ac929db54a3c5931ddab4867a3.zip CMake-bb2c7b7dc05c15ac929db54a3c5931ddab4867a3.tar.gz CMake-bb2c7b7dc05c15ac929db54a3c5931ddab4867a3.tar.bz2 |
FindMatlab: Fix logic error when minimum version is not found
Fix logic added by commit 7fdd5128b1 (FindMatlab: Fix version selection
if a version is given, 2021-07-02, v3.22.0-rc1~66^2). Ensure that
`_list_index` is always initialized to -1, akin to `list(FIND)` not
finding a match.
Issue: #22377
-rw-r--r-- | Modules/FindMatlab.cmake | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index f0e991b..3c7efbc 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -1573,6 +1573,7 @@ if(_numbers_of_matlab_roots GREATER 0) list(GET _matlab_possible_roots ${_list_index} Matlab_VERSION_STRING) list(GET _matlab_possible_roots ${_matlab_root_dir_index} Matlab_ROOT_DIR) elseif(DEFINED Matlab_FIND_VERSION) + set(_list_index -1) foreach(_matlab_root_index RANGE 1 ${_numbers_of_matlab_roots} 3) list(GET _matlab_possible_roots ${_matlab_root_index} _matlab_root_version) if(_matlab_root_version VERSION_GREATER_EQUAL Matlab_FIND_VERSION) |