From 31c58d23e0eb71f87a941ead853d81a160240150 Mon Sep 17 00:00:00 2001 From: hbristow Date: Sun, 15 Sep 2013 23:53:29 +1000 Subject: [PATCH] Streamlined mexext detection, with removal of trailing whitespace/newlines handled by execute_process --- cmake/OpenCVFindMatlab.cmake | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cmake/OpenCVFindMatlab.cmake b/cmake/OpenCVFindMatlab.cmake index 8c95dd4..468fdf3 100644 --- a/cmake/OpenCVFindMatlab.cmake +++ b/cmake/OpenCVFindMatlab.cmake @@ -125,15 +125,13 @@ endfunction() # sets the variable MATLAB_FOUND to TRUE function(locate_matlab_components MATLAB_ROOT_DIR) # get the mex extension - if (UNIX) - execute_process(COMMAND ${MATLAB_ROOT_DIR}/bin/mexext OUTPUT_VARIABLE MATLAB_MEXEXT_) - elseif (WIN32) - execute_process(COMMAND ${MATLAB_ROOT_DIR}/bin/mexext.bat OUTPUT_VARIABLE MATLAB_MEXEXT_) - endif() + find_file(MATLAB_MEXEXT_SCRIPT_ NAMES mexext mexext.bat PATHS ${MATLAB_ROOT_DIR}/bin NO_DEFAULT_PATH) + execute_process(COMMAND ${MATLAB_MEXEXT_SCRIPT_} + OUTPUT_VARIABLE MATLAB_MEXEXT_ + OUTPUT_STRIP_TRAILING_WHITESPACE) if (NOT MATLAB_MEXEXT_) return() endif() - string(STRIP ${MATLAB_MEXEXT_} MATLAB_MEXEXT_) # map the mexext to an architecture extension set(ARCHITECTURES_ "maci64" "maci" "glnxa64" "glnx64" "sol64" "sola64" "win32" "win64" ) -- 2.7.4