[mlpack-svn] r13714 - mlpack/trunk/src/mlpack/bindings/matlab

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Mon Oct 15 22:59:15 EDT 2012


Author: rcurtin
Date: 2012-10-15 22:59:15 -0400 (Mon, 15 Oct 2012)
New Revision: 13714

Modified:
   mlpack/trunk/src/mlpack/bindings/matlab/CMakeLists.txt
Log:
Clean up configuration so that MLPACK will compile on systems without MATLAB.
Also handle CMake policies more gracefully; I can't believe CMake just doesn't
ignore policies it doesn't know about.  Poor design...


Modified: mlpack/trunk/src/mlpack/bindings/matlab/CMakeLists.txt
===================================================================
--- mlpack/trunk/src/mlpack/bindings/matlab/CMakeLists.txt	2012-10-16 01:57:22 UTC (rev 13713)
+++ mlpack/trunk/src/mlpack/bindings/matlab/CMakeLists.txt	2012-10-16 02:59:15 UTC (rev 13714)
@@ -2,11 +2,22 @@
 # non-Linux systems.
 
 # We need the mex compiler for this to work.
-find_package(MatlabMex REQUIRED)
+find_package(MatlabMex)
 
-# Ignore the fact that we are setting CMAKE_SHARED_LIBRARY_CXX_FLAGS.
-cmake_policy(SET CMP0018 OLD)
+if(NOT "${MATLAB_MEX}")
+  message(STATUS
+      "MATLAB mex compiler not found; MATLAB bindings will not be built.")
+  message(STATUS "If MATLAB is installed, try specifying MATLAB_ROOT.")
+  return()
+endif(NOT "${MATLAB_MEX}")
 
+# Ignore the fact that we are setting CMAKE_SHARED_LIBRARY_CXX_FLAGS on CMake
+# 2.8.9 and newer.  Because we are requiring at least CMake 2.8.5, we only have
+# to check the patch version.
+if(${CMAKE_PATCH_VERSION} GREATER 8)
+  cmake_policy(SET CMP0018 OLD)
+endif(${CMAKE_PATCH_VERSION} GREATER 8)
+
 # Use the mex compiler to compile.
 set(CMAKE_CXX_COMPILER "${MATLAB_MEX}")
 




More information about the mlpack-svn mailing list