Browse Source

FindMatlab: Refactor Matlab root list append operation

Hermann von Kleist 1 year ago
parent
commit
37723c4bee
1 changed files with 4 additions and 6 deletions
  1. 4 6
      Modules/FindMatlab.cmake

+ 4 - 6
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()