From 4429d45761e47b14c96548c651c8fb6f6adca4da Mon Sep 17 00:00:00 2001 From: ismagom Date: Sat, 17 Jan 2015 13:13:29 -0500 Subject: [PATCH] Fixed warning in CMake when MATLAB not found --- cmake/modules/FindMATLAB.cmake | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/cmake/modules/FindMATLAB.cmake b/cmake/modules/FindMATLAB.cmake index a8218f8ba..00e959f14 100644 --- a/cmake/modules/FindMATLAB.cmake +++ b/cmake/modules/FindMATLAB.cmake @@ -84,14 +84,22 @@ else() if((NOT DEFINED MATLAB_ROOT) OR ("${MATLAB_ROOT}" STREQUAL "")) # get path to the Matlab root directory + execute_process( COMMAND which matlab - COMMAND xargs readlink - COMMAND xargs dirname - COMMAND xargs dirname - COMMAND xargs echo -n - OUTPUT_VARIABLE MATLAB_ROOT - ) + OUTPUT_VARIABLE MATLAB_BIN_EXISTS + ) + + IF (MATLAB_BIN_EXISTS) + execute_process( + COMMAND which matlab + COMMAND xargs readlink + COMMAND xargs dirname + COMMAND xargs dirname + COMMAND xargs echo -n + OUTPUT_VARIABLE MATLAB_ROOT + ) + ENDIF (MATLAB_BIN_EXISTS) endif() # Check if this is a Mac