diff options
author | Brad King <brad.king@kitware.com> | 2024-01-18 13:52:57 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2024-01-18 13:53:12 (GMT) |
commit | c065af700ab2d9ab2051982bca2d2bf7b1ffdd40 (patch) | |
tree | b282e006d6930ac30b4d1aa64d80171ac0923037 | |
parent | bef9f0920f4f89d29e0c1138d377f19a0130f79a (diff) | |
parent | 7060e2135c07515301de540fd65b106c1a6758c3 (diff) | |
download | CMake-c065af700ab2d9ab2051982bca2d2bf7b1ffdd40.zip CMake-c065af700ab2d9ab2051982bca2d2bf7b1ffdd40.tar.gz CMake-c065af700ab2d9ab2051982bca2d2bf7b1ffdd40.tar.bz2 |
Merge topic 'FindMatlab-fix-exact-version'
7060e2135c FindMatlab: Restore support for finding EXACT major.minor version
88a1392270 FindMatlab: use correct registry view when extracting versions
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9163
-rw-r--r-- | Modules/FindMatlab.cmake | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 24703a3..609cd4e 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -481,6 +481,7 @@ function(matlab_extract_all_installed_versions_from_registry win64 matlab_versio cmake_host_system_information(RESULT _reg QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Mathworks/${_installation_type}/${CMAKE_MATCH_1}" VALUE "MATLABROOT" + VIEW ${_view} ) _Matlab_VersionInfoXML("${_reg}" _matlab_version_tmp) @@ -1627,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() |