From cd4782bac3f3add76ef09d3fc3d6b57eb31748a8 Mon Sep 17 00:00:00 2001 From: Hermann von Kleist Date: Wed, 18 Sep 2024 16:56:34 +0200 Subject: [PATCH] FindMatlab: Only consider versioned MCR subdirectory if it exists Issue: #26306 --- Modules/FindMatlab.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index cc693ef08d..751741c4cf 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -636,11 +636,14 @@ function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_ string(REPLACE "." "" _matlab_current_version_without_dot "${_matlab_current_version}") if(IS_DIRECTORY "${current_MATLAB_ROOT}") + if(IS_DIRECTORY "${current_MATLAB_ROOT}/v${_matlab_current_version_without_dot}") + cmake_path(APPEND current_MATLAB_ROOT "v${_matlab_current_version_without_dot}") + endif() _Matlab_VersionInfoXML("${current_MATLAB_ROOT}" _matlab_version_tmp) if("${_matlab_version_tmp}" STREQUAL "unknown") 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}") + list(APPEND _matlab_roots_list "MCR" ${_matlab_version_tmp} "${current_MATLAB_ROOT}") endif() endforeach() endforeach()