mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 10:50:16 -06:00
FindMatlab: simplify mexext find logic
This eliminates an explicit for() loop
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user