From ba74c58ca45071178b37f24f254039ea53c56cdc Mon Sep 17 00:00:00 2001 From: Michael Hirsch Date: Wed, 31 Aug 2022 19:03:29 -0400 Subject: 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 --- Modules/FindMatlab.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 48ef5eb..1d88985 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") -- cgit v0.12