summaryrefslogtreecommitdiff
path: root/Modules/FindMatlab.cmake
diff options
context:
space:
mode:
authorscivision <scivision@users.noreply.github.com>2023-01-12 08:37:34 -0500
committerscivision <scivision@users.noreply.github.com>2023-01-12 08:41:13 -0500
commit8dcd14bb8725385a03418f030c7f4f77a9b4309f (patch)
treec19309eb884a41eca3a42c32bf14e5d0b06fb567 /Modules/FindMatlab.cmake
parentdf978c5aa86f1c83828d114d9f57ba50c2e0ac6a (diff)
downloadcmake-8dcd14bb8725385a03418f030c7f4f77a9b4309f.tar.gz
FindMatlab: simplify mexext find logic
This eliminates an explicit for() loop
Diffstat (limited to 'Modules/FindMatlab.cmake')
-rw-r--r--Modules/FindMatlab.cmake22
1 files changed, 3 insertions, 19 deletions
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 07a9adf2e3..9459e749bb 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -636,36 +636,20 @@ endfunction()
#]=======================================================================]
function(matlab_get_mex_suffix matlab_root mex_suffix)
- # todo setup the extension properly. Currently I do not know if this is
- # sufficient for all win32 distributions.
- # there is also CMAKE_EXECUTABLE_SUFFIX that could be tweaked
+ # find_program does not consider script suffix .bat for Matlab mexext.bat on Windows
set(mexext_suffix "")
if(WIN32)
- list(APPEND mexext_suffix ".bat")
+ set(mexext_suffix ".bat")
endif()
- # we first try without suffix, since cmake does not understand a list with
- # one empty string element
find_program(
Matlab_MEXEXTENSIONS_PROG
- NAMES mexext
+ NAMES mexext mexext${mexext_suffix}
PATHS ${matlab_root}/bin
DOC "Matlab MEX extension provider"
NO_DEFAULT_PATH
)
- foreach(current_mexext_suffix IN LISTS mexext_suffix)
- if(NOT DEFINED Matlab_MEXEXTENSIONS_PROG OR NOT Matlab_MEXEXTENSIONS_PROG)
- # this call should populate the cache automatically
- find_program(
- Matlab_MEXEXTENSIONS_PROG
- "mexext${current_mexext_suffix}"
- PATHS ${matlab_root}/bin
- DOC "Matlab MEX extension provider"
- NO_DEFAULT_PATH
- )
- endif()
- endforeach(current_mexext_suffix)
if(MATLAB_FIND_DEBUG)
message(STATUS "[MATLAB] Determining mex files extensions from '${matlab_root}/bin' with program '${Matlab_MEXEXTENSIONS_PROG}'")
endif()