diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 0b8ba86ee1..3365cebc71 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -551,10 +551,9 @@ function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_ if(IS_DIRECTORY "${current_MATLAB_ROOT}") _Matlab_VersionInfoXML("${current_MATLAB_ROOT}" _matlab_version_tmp) if("${_matlab_version_tmp}" STREQUAL "unknown") - list(APPEND _matlab_roots_list "MATLAB" ${_matlab_current_version} ${current_MATLAB_ROOT}) - else() - list(APPEND _matlab_roots_list "MATLAB" ${_matlab_version_tmp} ${current_MATLAB_ROOT}) + set(_matlab_version_tmp ${_matlab_current_version}) endif() + list(APPEND _matlab_roots_list "MATLAB" ${_matlab_version_tmp} ${current_MATLAB_ROOT}) endif() endforeach() @@ -574,10 +573,9 @@ function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_ if(IS_DIRECTORY "${current_MATLAB_ROOT}") _Matlab_VersionInfoXML("${current_MATLAB_ROOT}" _matlab_version_tmp) if("${_matlab_version_tmp}" STREQUAL "unknown") - list(APPEND _matlab_roots_list "MCR" ${_matlab_current_version} "${current_MATLAB_ROOT}/v${_matlab_current_version_without_dot}") - else() - list(APPEND _matlab_roots_list "MCR" ${_matlab_version_tmp} "${current_MATLAB_ROOT}/v${_matlab_current_version_without_dot}") + set(_matlab_version_tmp ${_matlab_current_version}) endif() + list(APPEND _matlab_roots_list "MCR" ${_matlab_version_tmp} "${current_MATLAB_ROOT}/v${_matlab_current_version_without_dot}") endif() endforeach() endforeach()