summaryrefslogtreecommitdiff
path: root/Modules/FindMatlab.cmake
diff options
context:
space:
mode:
authorRaffi Enficiaud <raffi.enficiaud@mines-paris.org>2019-07-15 01:52:02 +0200
committerRaffi Enficiaud <raffi.enficiaud@mines-paris.org>2019-07-15 01:52:02 +0200
commit9e6206c59bc00be53351cd87ad569896686aeb89 (patch)
treee4dc3f4e6fa4d27755266213d0930d65ff35912d /Modules/FindMatlab.cmake
parenta9b36ea69f36cbfe198bcd5d34a19955651dfa5a (diff)
downloadcmake-9e6206c59bc00be53351cd87ad569896686aeb89.tar.gz
FindMatlab: fixing extension bat file invocation error
If the environment variable MATLAB_ARCH is set prior to the call, the called scripts do not return an error message.
Diffstat (limited to 'Modules/FindMatlab.cmake')
-rw-r--r--Modules/FindMatlab.cmake13
1 files changed, 11 insertions, 2 deletions
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 26b94190cc..432562309f 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -609,14 +609,23 @@ function(matlab_get_mex_suffix matlab_root mex_suffix)
set(devnull INPUT_FILE NUL)
endif()
+ if(WIN32)
+ # this environment variable is used to determine the arch on Windows
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(ENV{MATLAB_ARCH} "win64")
+ else()
+ set(ENV{MATLAB_ARCH} "win32")
+ endif()
+ endif()
+
# this is the preferred way. If this does not work properly (eg. MCR on Windows), then we use our own knowledge
execute_process(
COMMAND ${Matlab_MEXEXTENSIONS_PROG}
OUTPUT_VARIABLE _matlab_mex_extension
- #RESULT_VARIABLE _matlab_mex_extension_call
ERROR_VARIABLE _matlab_mex_extension_error
OUTPUT_STRIP_TRAILING_WHITESPACE
${devnull})
+ unset(ENV{MATLAB_ARCH})
if(_matlab_mex_extension_error)
if(WIN32)
@@ -631,7 +640,7 @@ function(matlab_get_mex_suffix matlab_root mex_suffix)
string(STRIP "${_matlab_mex_extension}" _matlab_mex_extension)
if(MATLAB_FIND_DEBUG)
- message(STATUS "[MATLAB] '${Matlab_MEXEXTENSIONS_PROG}' : returned '${_matlab_mex_extension_call}', determined extension '${_matlab_mex_extension}' and error string is '${_matlab_mex_extension_error}'")
+ message(STATUS "[MATLAB] '${Matlab_MEXEXTENSIONS_PROG}' : determined extension '${_matlab_mex_extension}' and error string is '${_matlab_mex_extension_error}'")
endif()
unset(Matlab_MEXEXTENSIONS_PROG CACHE)