From 9e97893147e7233381b545fe20aa192ba2b7dd6b Mon Sep 17 00:00:00 2001 From: scivision Date: Mon, 15 Jan 2024 23:36:13 -0500 Subject: FindMatlab: set MATLAB_ARCH per process call this is just a best practice refactor. --- Modules/FindMatlab.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index c5379d5..f14fa7e 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -660,23 +660,23 @@ function(matlab_get_mex_suffix matlab_root mex_suffix) set(devnull INPUT_FILE NUL) endif() + set(_arch) 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") + set(_arch "MATLAB_ARCH=win64") else() - set(ENV{MATLAB_ARCH} "win32") + set(_arch "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} + COMMAND ${CMAKE_COMMAND} -E env ${_arch} ${Matlab_MEXEXTENSIONS_PROG} OUTPUT_VARIABLE _matlab_mex_extension ERROR_VARIABLE _matlab_mex_extension_error OUTPUT_STRIP_TRAILING_WHITESPACE ${devnull}) - unset(ENV{MATLAB_ARCH}) if(_matlab_mex_extension_error) if(WIN32) -- cgit v0.12