Commit ac748747 authored by Hilton Bristow's avatar Hilton Bristow Committed by hbristow

FindMatlab.cmake in cmake find_package format

parent de93408d
...@@ -59,7 +59,7 @@ if(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8") ...@@ -59,7 +59,7 @@ if(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8")
endif() endif()
project(OpenCV CXX C) project(OpenCV CXX C)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/Modules)
include(cmake/OpenCVUtils.cmake) include(cmake/OpenCVUtils.cmake)
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
...@@ -422,7 +422,8 @@ if(WITH_OPENCL) ...@@ -422,7 +422,8 @@ if(WITH_OPENCL)
endif() endif()
# --- Matlab/Octave --- # --- Matlab/Octave ---
include(cmake/OpenCVFindMatlab.cmake) find_package(matlab)
#include(cmake/OpenCVFindMatlab.cmake)
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Solution folders: # Solution folders:
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
# MATLAB_FOUND: true/false # MATLAB_FOUND: true/false
# MATLAB_ROOT_DIR: Root of Matlab installation # MATLAB_ROOT_DIR: Root of Matlab installation
# MATLAB_MEX_SCRIPT The mex script used to compile mex files # MATLAB_MEX_SCRIPT The mex script used to compile mex files
# MATLAB_INCLUDE_DIRS Path to "mex.h" # MATLAB_INCLUDE_DIR Path to "mex.h"
# MATLAB_LIBRARY_DIRS Path to mex and matrix libraries # MATLAB_LIBRARY_DIR Path to mex and matrix libraries
# MATLAB_LIBS The Matlab libs, usually mx, mex, mat # MATLAB_LIBS The Matlab libs, usually mx, mex, mat
# MATLAB_MEXEXT The mex library extension. It will be one of: # MATLAB_MEXEXT The mex library extension. It will be one of:
# mexwin32, mexwin64, mexglx, mexa64, mexmac, # mexwin32, mexwin64, mexglx, mexa64, mexmac,
...@@ -76,6 +76,10 @@ MACRO(locate_matlab_root) ...@@ -76,6 +76,10 @@ MACRO(locate_matlab_root)
endforeach() endforeach()
endif() endif()
# unset local variables # unset local variables
unset(REG_ROOTS_)
unset(REG_ROOT_)
unset(VERSIONS_)
unset(VERSION_)
unset(SEARCH_DIRS_) unset(SEARCH_DIRS_)
unset(DIR_) unset(DIR_)
endMACRO() endMACRO()
...@@ -99,16 +103,16 @@ MACRO(locate_matlab_components MATLAB_ROOT_DIR) ...@@ -99,16 +103,16 @@ MACRO(locate_matlab_components MATLAB_ROOT_DIR)
string(REPLACE "mex" "" MATLAB_ARCH ${MATLAB_MEXEXT}) string(REPLACE "mex" "" MATLAB_ARCH ${MATLAB_MEXEXT})
# get the path to the libraries # get the path to the libraries
set(MATLAB_LIBRARY_DIRS ${MATLAB_ROOT_DIR}/bin/${MATLAB_ARCH}) set(MATLAB_LIBRARY_DIR ${MATLAB_ROOT_DIR}/bin/${MATLAB_ARCH})
# get the libraries # get the libraries
find_library(MATLAB_LIB_MX mx PATHS ${MATLAB_LIBRARY_DIRS} NO_DEFAULT_PATH) find_library(MATLAB_LIB_MX mx PATHS ${MATLAB_LIBRARY_DIR} NO_DEFAULT_PATH)
find_library(MATLAB_LIB_MEX mex PATHS ${MATLAB_LIBRARY_DIRS} NO_DEFAULT_PATH) find_library(MATLAB_LIB_MEX mex PATHS ${MATLAB_LIBRARY_DIR} NO_DEFAULT_PATH)
find_library(MATLAB_LIB_MAT mat PATHS ${MATLAB_LIBRARY_DIRS} NO_DEFAULT_PATH) find_library(MATLAB_LIB_MAT mat PATHS ${MATLAB_LIBRARY_DIR} NO_DEFAULT_PATH)
set(MATLAB_LIBS ${MATLAB_LIB_MX} ${MATLAB_LIB_MEX} ${MATLAB_LIB_MAT}) set(MATLAB_LIBS ${MATLAB_LIB_MX} ${MATLAB_LIB_MEX} ${MATLAB_LIB_MAT})
# get the include path # get the include path
find_path(MATLAB_INCLUDE_DIRS mex.h ${MATLAB_ROOT_DIR}/extern/include) find_path(MATLAB_INCLUDE_DIR mex.h ${MATLAB_ROOT_DIR}/extern/include)
# get the mex shell script # get the mex shell script
find_file(MATLAB_MEX_SCRIPT NAMES mex mex.bat PATHS ${MATLAB_ROOT_DIR}/bin NO_DEFAULT_PATH) find_file(MATLAB_MEX_SCRIPT NAMES mex mex.bat PATHS ${MATLAB_ROOT_DIR}/bin NO_DEFAULT_PATH)
...@@ -133,8 +137,9 @@ if (NOT MATLAB_FOUND) ...@@ -133,8 +137,9 @@ if (NOT MATLAB_FOUND)
if (MATLAB_ROOT_DIR) if (MATLAB_ROOT_DIR)
locate_matlab_components(${MATLAB_ROOT_DIR}) locate_matlab_components(${MATLAB_ROOT_DIR})
endif() endif()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Matlab DEFAULT_MSG MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS find_package_handle_standard_args(Matlab DEFAULT_MSG MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIR
MATLAB_LIBS MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH) MATLAB_ROOT_DIR MATLAB_LIBS MATLAB_LIBRARY_DIR
MATLAB_MEXEXT MATLAB_ARCH)
# if Matlab was not found, unset the local variables # if Matlab was not found, unset the local variables
if (NOT MATLAB_FOUND) if (NOT MATLAB_FOUND)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment