summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-09-02 12:55:43 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-09-02 12:55:59 (GMT)
commitde2b305ddd9f5e6d41eea090aceaacf2a959297a (patch)
treef07115c4e4d050f47ad4ba387424a15ed0813589
parentc7f9d74e54c28c982b58fbfcdfefd21309a4e175 (diff)
parent72dd6806095a8a8b8ef2a4e55e476014882a62fe (diff)
downloadCMake-de2b305ddd9f5e6d41eea090aceaacf2a959297a.zip
CMake-de2b305ddd9f5e6d41eea090aceaacf2a959297a.tar.gz
CMake-de2b305ddd9f5e6d41eea090aceaacf2a959297a.tar.bz2
Merge topic 'matlab_root'
72dd680609 FindMatlab: follow CMP0074 <PackageName>_ROOT search behavior ba74c58ca4 FindMatlab: add'l check that Matlab test version file exists Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7616
-rw-r--r--Modules/FindMatlab.cmake26
1 files changed, 25 insertions, 1 deletions
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 48ef5eb..ec2c345 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -85,10 +85,18 @@ Module Input Variables
Users or projects may set the following variables to configure the module
behavior:
+:variable:`Matlab_ROOT <<PackageName>_ROOT>`
+ .. versionadded:: 3.25
+
+ Default value for :variable:`Matlab_ROOT_DIR`, the root of the Matlab
+ installation.
+
:variable:`Matlab_ROOT_DIR`
- the root of the Matlab installation.
+ The root of the Matlab installation.
+
:variable:`MATLAB_FIND_DEBUG`
outputs debug information
+
:variable:`MATLAB_ADDITIONAL_VERSIONS`
additional versions of Matlab for the automatic retrieval of the installed
versions.
@@ -843,6 +851,15 @@ function(matlab_get_version_from_matlab_run matlab_binary_program matlab_list_ve
endif()
endif()
+ if(NOT EXISTS "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp")
+ # last resort check as some HPC with "module load matlab" not enacted fail to catch in earlier checks
+ # and error CMake configure even if find_package(Matlab) is not REQUIRED
+ if(MATLAB_FIND_DEBUG)
+ message(WARNING "[MATLAB] Unable to determine the version of Matlab. The version log file does not exist.")
+ endif()
+ return()
+ endif()
+
# if successful, read back the log
file(READ "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp" _matlab_version_from_cmd)
file(REMOVE "${_matlab_temporary_folder}/matlabVersionLog.cmaketmp")
@@ -1572,6 +1589,13 @@ endfunction()
# this variable will get all Matlab installations found in the current system.
set(_matlab_possible_roots)
+if(NOT DEFINED Matlab_ROOT AND DEFINED ENV{Matlab_ROOT})
+ set(Matlab_ROOT $ENV{Matlab_ROOT})
+endif()
+if(DEFINED Matlab_ROOT)
+ set(Matlab_ROOT_DIR ${Matlab_ROOT})
+endif()
+
if(Matlab_ROOT_DIR)
# if the user specifies a possible root, we keep this one