ENH: update for Tcl/Tk 8.5
[cmake.git] / Modules / FindMatlab.cmake
blob17e6f367fbfaa0303495497e84f42ac4334fe3d1
1 # - this module looks for Matlab
2 # Defines:
3 #  MATLAB_INCLUDE_DIR: include path for mex.h, engine.h
4 #  MATLAB_LIBRARIES:   required libraries: libmex, etc
5 #  MATLAB_MEX_LIBRARY: path to libmex.lib
6 #  MATLAB_MX_LIBRARY:  path to libmx.lib
7 #  MATLAB_ENG_LIBRARY: path to libeng.lib
10 SET(MATLAB_FOUND 0)
11 IF(WIN32)
12   IF(${CMAKE_GENERATOR} MATCHES "Visual Studio 6")
13     SET(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/msvc60")
14   ELSE(${CMAKE_GENERATOR} MATCHES "Visual Studio 6")
15     IF(${CMAKE_GENERATOR} MATCHES "Visual Studio 7")
16       # Assume people are generally using 7.1,
17       # if using 7.0 need to link to: ../extern/lib/win32/microsoft/msvc70
18       SET(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/msvc71")
19     ELSE(${CMAKE_GENERATOR} MATCHES "Visual Studio 7")
20       IF(${CMAKE_GENERATOR} MATCHES "Borland")
21         # Same here, there are also: bcc50 and bcc51 directories
22         SET(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/lib/win32/microsoft/bcc54")
23       ELSE(${CMAKE_GENERATOR} MATCHES "Borland")
24         MESSAGE(FATAL_ERROR "Generator not compatible: ${CMAKE_GENERATOR}")
25       ENDIF(${CMAKE_GENERATOR} MATCHES "Borland")
26     ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio 7")
27   ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio 6")
28   FIND_LIBRARY(MATLAB_MEX_LIBRARY
29     libmex
30     ${MATLAB_ROOT}
31     )
32   FIND_LIBRARY(MATLAB_MX_LIBRARY
33     libmx
34     ${MATLAB_ROOT}
35     )
36   FIND_LIBRARY(MATLAB_ENG_LIBRARY
37     libeng
38     ${MATLAB_ROOT}
39     )
41   FIND_PATH(MATLAB_INCLUDE_DIR
42     "mex.h"
43     "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]/extern/include"
44     )
45 ELSE( WIN32 )
46   IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
47     # Regular x86
48     SET(MATLAB_ROOT
49       /usr/local/matlab-7sp1/bin/glnx86/
50       /opt/matlab-7sp1/bin/glnx86/
51       $ENV{HOME}/matlab-7sp1/bin/glnx86/
52       $ENV{HOME}/redhat-matlab/bin/glnx86/
53       )
54   ELSE(CMAKE_SIZEOF_VOID_P EQUAL 4)
55     # AMD64:
56     SET(MATLAB_ROOT
57       /usr/local/matlab-7sp1/bin/glnxa64/
58       /opt/matlab-7sp1/bin/glnxa64/
59       $ENV{HOME}/matlab7_64/bin/glnxa64/
60       $ENV{HOME}/matlab-7sp1/bin/glnxa64/
61       $ENV{HOME}/redhat-matlab/bin/glnxa64/
62       )
63   ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
64   FIND_LIBRARY(MATLAB_MEX_LIBRARY
65     mex
66     ${MATLAB_ROOT}
67     )
68   FIND_LIBRARY(MATLAB_MX_LIBRARY
69     mx
70     ${MATLAB_ROOT}
71     )
72   FIND_LIBRARY(MATLAB_ENG_LIBRARY
73     eng
74     ${MATLAB_ROOT}
75     )
76   FIND_PATH(MATLAB_INCLUDE_DIR
77     "mex.h"
78     "/usr/local/matlab-7sp1/extern/include/"
79     "/opt/matlab-7sp1/extern/include/"
80     "$ENV{HOME}/matlab-7sp1/extern/include/"
81     "$ENV{HOME}/redhat-matlab/extern/include/"
82     )
84 ENDIF(WIN32)
86 # This is common to UNIX and Win32:
87 SET(MATLAB_LIBRARIES
88   ${MATLAB_MEX_LIBRARY}
89   ${MATLAB_MX_LIBRARY}
90   ${MATLAB_ENG_LIBRARY}
93 IF(MATLAB_INCLUDE_DIR AND MATLAB_LIBRARIES)
94   SET(MATLAB_FOUND 1)
95 ENDIF(MATLAB_INCLUDE_DIR AND MATLAB_LIBRARIES)
97 MARK_AS_ADVANCED(
98   MATLAB_LIBRARIES
99   MATLAB_MEX_LIBRARY
100   MATLAB_MX_LIBRARY
101   MATLAB_ENG_LIBRARY
102   MATLAB_INCLUDE_DIR
103   MATLAB_FOUND
104   MATLAB_ROOT