diff options
author | Hermann von Kleist <hermann.von.kleist@ivi.fraunhofer.de> | 2024-01-17 15:24:11 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-01-17 15:33:48 (GMT) |
commit | 7060e2135c07515301de540fd65b106c1a6758c3 (patch) | |
tree | af3bf2e645d88f0eb7736a8711950e94def781c2 | |
parent | 88a1392270e38ec6d47f33d8ab5345a16b1b0310 (diff) | |
download | CMake-7060e2135c07515301de540fd65b106c1a6758c3.zip CMake-7060e2135c07515301de540fd65b106c1a6758c3.tar.gz CMake-7060e2135c07515301de540fd65b106c1a6758c3.tar.bz2 |
FindMatlab: Restore support for finding EXACT major.minor version
By comparing major.minor, the behavior approximately matches pre-3.28
behavior.
Fixes: #25605
-rw-r--r-- | Modules/FindMatlab.cmake | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 0e79f58..609cd4e 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -1628,7 +1628,17 @@ set(Matlab_VERSION_STRING "NOTFOUND") set(Matlab_Or_MCR "UNKNOWN") if(_numbers_of_matlab_roots GREATER 0) if(Matlab_FIND_VERSION_EXACT) - list(FIND _matlab_possible_roots ${Matlab_FIND_VERSION} _list_index) + 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) + # only the major.minor version is used + string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _matlab_root_version "${_matlab_root_version}") + if(_matlab_root_version VERSION_EQUAL Matlab_FIND_VERSION) + set(_list_index ${_matlab_root_index}) + break() + endif() + endforeach() + if(_list_index LESS 0) set(_list_index 1) endif() |