mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-04 05:10:10 -05:00
FindMatlab: On macOS search under ~/Applications and /Applications
users with locked-down macOS may not be able to install their desired Matlab under /Applications, but may use the standard ~/Applications instead
This commit is contained in:
+26
-24
@@ -66,8 +66,9 @@ specific:
|
|||||||
Windows registry. The ``REGISTRY_VIEW`` argument may optionally be specified
|
Windows registry. The ``REGISTRY_VIEW`` argument may optionally be specified
|
||||||
to manually control whether 32bit or 64bit versions shall be searched for.
|
to manually control whether 32bit or 64bit versions shall be searched for.
|
||||||
* macOS: The installed versions of Matlab/MCR are given by the MATLAB
|
* macOS: The installed versions of Matlab/MCR are given by the MATLAB
|
||||||
default installation paths in ``/Application``. If no such application is
|
default installation paths under ``$HOME/Applications`` and ``/Applications``.
|
||||||
found, it falls back to the one that might be accessible from the ``PATH``.
|
If no such application is found, it falls back to the one that might be
|
||||||
|
accessible from the ``PATH``.
|
||||||
* Unix: The desired Matlab should be accessible from the ``PATH``. This does
|
* Unix: The desired Matlab should be accessible from the ``PATH``. This does
|
||||||
not work for MCR installation and :variable:`Matlab_ROOT_DIR` should be
|
not work for MCR installation and :variable:`Matlab_ROOT_DIR` should be
|
||||||
specified on this platform.
|
specified on this platform.
|
||||||
@@ -1489,7 +1490,7 @@ endfunction()
|
|||||||
function(_Matlab_find_instances_macos matlab_roots)
|
function(_Matlab_find_instances_macos matlab_roots)
|
||||||
|
|
||||||
set(_matlab_possible_roots)
|
set(_matlab_possible_roots)
|
||||||
# on mac, we look for the /Application paths
|
# on macOS, we look for the standard /Applications paths
|
||||||
# this corresponds to the behavior on Windows. On Linux, we do not have
|
# this corresponds to the behavior on Windows. On Linux, we do not have
|
||||||
# any other guess.
|
# any other guess.
|
||||||
matlab_get_supported_releases(_matlab_releases)
|
matlab_get_supported_releases(_matlab_releases)
|
||||||
@@ -1499,32 +1500,33 @@ function(_Matlab_find_instances_macos matlab_roots)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
foreach(_matlab_current_release IN LISTS _matlab_releases)
|
foreach(_matlab_current_release IN LISTS _matlab_releases)
|
||||||
matlab_get_version_from_release_name("${_matlab_current_release}" _matlab_current_version)
|
foreach(_macos_app_base IN ITEMS "$ENV{HOME}/Applications" "/Applications")
|
||||||
string(REPLACE "." "" _matlab_current_version_without_dot "${_matlab_current_version}")
|
matlab_get_version_from_release_name("${_matlab_current_release}" _matlab_current_version)
|
||||||
set(_matlab_base_path "/Applications/MATLAB_${_matlab_current_release}.app")
|
string(REPLACE "." "" _matlab_current_version_without_dot "${_matlab_current_version}")
|
||||||
|
set(_matlab_base_path "${_macos_app_base}/MATLAB_${_matlab_current_release}.app")
|
||||||
|
|
||||||
_Matlab_VersionInfoXML("${_matlab_base_path}" _matlab_version_tmp)
|
_Matlab_VersionInfoXML("${_matlab_base_path}" _matlab_version_tmp)
|
||||||
if(NOT "${_matlab_version_tmp}" STREQUAL "unknown")
|
if(NOT "${_matlab_version_tmp}" STREQUAL "unknown")
|
||||||
set(_matlab_current_version ${_matlab_version_tmp})
|
set(_matlab_current_version ${_matlab_version_tmp})
|
||||||
endif()
|
|
||||||
|
|
||||||
# Check Matlab, has precedence over MCR
|
|
||||||
if(IS_DIRECTORY "${_matlab_base_path}")
|
|
||||||
if(MATLAB_FIND_DEBUG)
|
|
||||||
message(STATUS "[MATLAB] Found version ${_matlab_current_release} (${_matlab_current_version}) in ${_matlab_base_path}")
|
|
||||||
endif()
|
endif()
|
||||||
list(APPEND _matlab_possible_roots "MATLAB" ${_matlab_current_version} ${_matlab_base_path})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Checks MCR
|
# Check Matlab, has precedence over MCR
|
||||||
set(_mcr_path "/Applications/MATLAB/MATLAB_Runtime/v${_matlab_current_version_without_dot}")
|
if(IS_DIRECTORY "${_matlab_base_path}")
|
||||||
if(IS_DIRECTORY "${_mcr_path}")
|
if(MATLAB_FIND_DEBUG)
|
||||||
if(MATLAB_FIND_DEBUG)
|
message(STATUS "[MATLAB] Found version ${_matlab_current_release} (${_matlab_current_version}) in ${_matlab_base_path}")
|
||||||
message(STATUS "[MATLAB] Found MCR version ${_matlab_current_release} (${_matlab_current_version}) in ${_mcr_path}")
|
endif()
|
||||||
|
list(APPEND _matlab_possible_roots "MATLAB" ${_matlab_current_version} ${_matlab_base_path})
|
||||||
endif()
|
endif()
|
||||||
list(APPEND _matlab_possible_roots "MCR" ${_matlab_current_version} ${_mcr_path})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
# Checks MCR
|
||||||
|
set(_mcr_path "${_macos_app_base}/MATLAB/MATLAB_Runtime/v${_matlab_current_version_without_dot}")
|
||||||
|
if(IS_DIRECTORY "${_mcr_path}")
|
||||||
|
if(MATLAB_FIND_DEBUG)
|
||||||
|
message(STATUS "[MATLAB] Found MCR version ${_matlab_current_release} (${_matlab_current_version}) in ${_mcr_path}")
|
||||||
|
endif()
|
||||||
|
list(APPEND _matlab_possible_roots "MCR" ${_matlab_current_version} ${_mcr_path})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
endforeach()
|
endforeach()
|
||||||
set(${matlab_roots} ${_matlab_possible_roots} PARENT_SCOPE)
|
set(${matlab_roots} ${_matlab_possible_roots} PARENT_SCOPE)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user