-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathFindOPENCV2.cmake
115 lines (96 loc) · 3.46 KB
/
FindOPENCV2.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# - Find OPENCV2
# Find the OPENCV2 includes and library
#
# OPENCV2_INCLUDE_DIR - Where to find OPENCV2 includes
# OPENCV2_LIBRARIES - List of libraries when using OPENCV2
# OPENCV2_FOUND - True if OPENCV2 was found
IF(OPENCV2_INCLUDE_DIR)
SET(OPENCV2_FIND_QUIETLY TRUE)
ENDIF(OPENCV2_INCLUDE_DIR)
SET(OPENCV2_EXTERNLIBS $ENV{EXTERNLIBS}/opencv2/)
FIND_PATH(OPENCV2_INCLUDE_DIR "opencv/cv.h"
PATHS
${OPENCV2_EXTERNLIBS}/include
$ENV{OPENCV2_HOME}/include
~/Library/Frameworks/include
/Library/Frameworks/include
/usr/local/include
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
DOC "OpenCV - Headers"
NO_DEFAULT_PATH
)
FIND_PATH(OPENCV2_INCLUDE_DIR "opencv/cv.h"
DOC "OpenCV - Headers"
)
INCLUDE(FindPackageHandleStandardArgs)
MACRO(FIND_OPENCV2_COMPONENT component version)
STRING(TOUPPER ${component} _uppercomponent)
SET(OPENCV2_NAMES opencv_${component}${version} opencv_${component})
SET(OPENCV2_WOV_NAMES opencv_${component})
SET(OPENCV2_DBG_NAMES opencv_${component}${version}d)
FIND_LIBRARY(OPENCV2_${_uppercomponent}_LIBRARY NAMES ${OPENCV2_NAMES}
PATHS
${OPENCV2_EXTERNLIBS}
$ENV{OPENCV2_HOME}
${OPENCV2_EXTERNLIBS}/x64/vc14
${OPENCV2_EXTERNLIBS}/x64/vc12
${OPENCV2_EXTERNLIBS}/x64/vc11
${OPENCV2_EXTERNLIBS}/x64/vc10
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt
PATH_SUFFIXES lib lib64
DOC "OPENCV2 - Library"
NO_DEFAULT_PATH
)
FIND_LIBRARY(OPENCV2_${_uppercomponent}_LIBRARY NAMES ${OPENCV2_NAMES}
DOC "OPENCV2 - Library"
)
IF(MSVC)
# VisualStudio needs a debug version
#MESSAGE(${OPENCV2_DBG_NAMES})
FIND_LIBRARY(OPENCV2_${_uppercomponent}_LIBRARY_DEBUG NAMES ${OPENCV2_DBG_NAMES}
PATHS
$ENV{OPENCV2_HOME}/lib
${OPENCV2_EXTERNLIBS}/x64/vc14/lib
${OPENCV2_EXTERNLIBS}/x64/vc12/lib
${OPENCV2_EXTERNLIBS}/x64/vc11/lib
${OPENCV2_EXTERNLIBS}/x64/vc10/lib
DOC "OPENCV2 - Library (Debug)"
)
IF(OPENCV2_${_uppercomponent}_LIBRARY_DEBUG AND OPENCV2_${_uppercomponent}_LIBRARY)
SET(OPENCV2_LIBRARIES ${OPENCV2_LIBRARIES} optimized ${OPENCV2_${_uppercomponent}_LIBRARY} debug ${OPENCV2_${_uppercomponent}_LIBRARY_DEBUG})
ENDIF(OPENCV2_${_uppercomponent}_LIBRARY_DEBUG AND OPENCV2_${_uppercomponent}_LIBRARY)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENCV2_${_uppercomponent} DEFAULT_MSG OPENCV2_${_uppercomponent}_LIBRARY OPENCV2_${_uppercomponent}_LIBRARY_DEBUG OPENCV2_INCLUDE_DIR)
MARK_AS_ADVANCED(OPENCV2_${_uppercomponent}_LIBRARY OPENCV2_${_uppercomponent}_LIBRARY_DEBUG OPENCV2_INCLUDE_DIR)
ELSE(MSVC)
# rest of the world
FIND_LIBRARY(OPENCV2_${_uppercomponent}_LIBRARY NAMES ${OPENCV2_WOV_NAMES}
PATHS
$ENV{OPENCV2_HOME}/lib
DOC "OPENCV2 - Library (WOV)"
)
SET(OPENCV2_LIBRARIES ${OPENCV2_LIBRARIES} ${OPENCV2_${_uppercomponent}_LIBRARY})
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENCV2_${_uppercomponent} DEFAULT_MSG OPENCV2_${_uppercomponent}_LIBRARY OPENCV2_INCLUDE_DIR)
MARK_AS_ADVANCED(OPENCV2_${_uppercomponent}_LIBRARY OPENCV2_INCLUDE_DIR)
ENDIF(MSVC)
ENDMACRO(FIND_OPENCV2_COMPONENT)
FIND_OPENCV2_COMPONENT(core 2412)
FIND_OPENCV2_COMPONENT(objdetect 2412)
FIND_OPENCV2_COMPONENT(highgui 2412)
FIND_OPENCV2_COMPONENT(imgproc 2412)
if(OPENCV2_CORE_FOUND AND OPENCV2_OBJDETECT_FOUND AND OPENCV2_HIGHGUI_FOUND AND OPENCV2_IMGPROC_FOUND)
set(OPENCV2_FOUND TRUE)
endif()
IF(OPENCV2_FOUND)
SET(OPENCV2_INCLUDE_DIRS ${OPENCV2_INCLUDE_DIR})
ENDIF(OPENCV2_FOUND)