summaryrefslogtreecommitdiff
path: root/Modules/FindMatlab.cmake
diff options
context:
space:
mode:
authorMichael Hirsch <scivision@users.noreply.gitlab.kitware.com>2022-08-31 19:03:29 -0400
committerBrad King <brad.king@kitware.com>2022-09-01 10:35:41 -0400
commitba74c58ca45071178b37f24f254039ea53c56cdc (patch)
tree0fb9e9b3508e32424cf293d396f6686d90830abf /Modules/FindMatlab.cmake
parentf7fc864c3ae26afa1ec8670699782e3da037a1d9 (diff)
downloadcmake-ba74c58ca45071178b37f24f254039ea53c56cdc.tar.gz
FindMatlab: add'l check that Matlab test version file exists
this last resort check is for some HPC with "module load matlab" not enacted that fail to catch in earlier checks. That would error CMake configure even if find_package(Matlab) is not REQUIRED
Diffstat (limited to 'Modules/FindMatlab.cmake')
-rw-r--r--Modules/FindMatlab.cmake9
1 files changed, 9 insertions, 0 deletions
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 48ef5eb681..1d8898557c 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -843,6 +843,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")