-
Notifications
You must be signed in to change notification settings - Fork 0
/
OpenCVConfig.cmake.in
170 lines (150 loc) · 7.27 KB
/
OpenCVConfig.cmake.in
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# ===================================================================================
# The OpenCV CMake configuration file
#
# ** File generated automatically, do not modify **
#
# Usage from an external project:
# In your CMakeLists.txt, add these lines:
#
# FIND_PACKAGE(OpenCV REQUIRED )
# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OpenCV_LIBS})
#
# This file will define the following variables:
# - OpenCV_LIBS : The list of libraries to links against.
# - OpenCV_LIB_DIR : The directory where lib files are. Calling LINK_DIRECTORIES
# with this path is NOT needed.
# - OpenCV_INCLUDE_DIRS : The OpenCV include directories.
# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability
# - OpenCV_VERSION : The version of this OpenCV build. Example: "@OPENCV_VERSION@"
# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_MAJOR@"
# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_MINOR@"
# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "@OPENCV_VERSION_PATCH@"
#
# Advanced variables:
# - OpenCV_SHARED
# - OpenCV_CONFIG_PATH
# - OpenCV_INSTALL_PATH
# - OpenCV_LIB_COMPONENTS
# - OpenCV_EXTRA_COMPONENTS
# - OpenCV_USE_MANGLED_PATHS
# - OpenCV_HAVE_ANDROID_CAMERA
#
# =================================================================================================
# ======================================================
# Version Compute Capability from which library OpenCV
# has been compiled is remembered
# ======================================================
SET(OpenCV_COMPUTE_CAPABILITIES @OpenCV_CUDA_CC@)
# Some additional settings are required if OpenCV is built as static libs
set(OpenCV_SHARED @BUILD_SHARED_LIBS@)
# Enables mangled install paths, that help with side by side installs
set(OpenCV_USE_MANGLED_PATHS @OPENCV_MANGLED_INSTALL_PATHS@)
# Extract the directory where *this* file has been installed (determined at cmake run-time)
get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)
# Get the absolute path with no ../.. relative marks, to eliminate implicit linker warnings
get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../.." REALPATH)
# Presence of Android native camera support
set (OpenCV_HAVE_ANDROID_CAMERA @WITH_ANDROID_CAMERA@)
# ======================================================
# Include directories to add to the user project:
# ======================================================
# Provide the include directories to the caller
SET(OpenCV_INCLUDE_DIRS @CMAKE_INCLUDE_DIRS_CONFIGCMAKE@)
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
# ======================================================
# Link directories to add to the user project:
# ======================================================
# Provide the libs directory anyway, it may be needed in some cases.
SET(OpenCV_LIB_DIR @CMAKE_LIB_DIRS_CONFIGCMAKE@)
LINK_DIRECTORIES(${OpenCV_LIB_DIR})
# ====================================================================
# Link libraries: e.g. libopencv_core.so, opencv_imgproc220d.lib, etc...
# ====================================================================
SET(OpenCV_LIB_COMPONENTS opencv_contrib opencv_legacy opencv_objdetect opencv_calib3d opencv_features2d opencv_video opencv_highgui opencv_ml opencv_imgproc opencv_flann opencv_core )
#libraries order is very important because linker from Android NDK is one-pass linker
if(NOT ANDROID)
LIST(INSERT OpenCV_LIB_COMPONENTS 0 opencv_gpu)
ELSEIF(NOT OpenCV_SHARED AND OpenCV_HAVE_ANDROID_CAMERA)
LIST(APPEND OpenCV_LIB_COMPONENTS opencv_androidcamera)
endif()
if(OpenCV_USE_MANGLED_PATHS)
#be explicit about the library names.
set(OpenCV_LIB_COMPONENTS_ )
foreach( CVLib ${OpenCV_LIB_COMPONENTS})
list(APPEND OpenCV_LIB_COMPONENTS_ ${OpenCV_LIB_DIR}/lib${CVLib}.so.@OPENCV_VERSION@ )
endforeach()
set(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS_})
endif()
SET(OpenCV_LIBS "")
if(WIN32)
foreach(__CVLIB ${OpenCV_LIB_COMPONENTS})
# CMake>=2.6 supports the notation "debug XXd optimized XX"
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 2.4)
# Modern CMake:
SET(OpenCV_LIBS ${OpenCV_LIBS} debug ${__CVLIB}@OPENCV_DLLVERSION@@OPENCV_DEBUG_POSTFIX@ optimized ${__CVLIB}@OPENCV_DLLVERSION@)
else()
# Old CMake:
SET(OpenCV_LIBS ${OpenCV_LIBS} ${__CVLIB}@OPENCV_DLLVERSION@)
endif()
endforeach()
else()
foreach(__CVLIB ${OpenCV_LIB_COMPONENTS})
SET(OpenCV_LIBS ${OpenCV_LIBS} ${__CVLIB})
endforeach()
endif()
# ==============================================================
# Extra include directories, needed by OpenCV 2 new structure
# ==============================================================
if(NOT "@CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE@" STREQUAL "")
foreach(__CVLIB ${OpenCV_LIB_COMPONENTS})
# We only need the "core",... part here: "opencv_core" -> "core"
STRING(REGEX REPLACE "opencv_(.*)" "\\1" __MODNAME ${__CVLIB})
INCLUDE_DIRECTORIES("@CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE@/modules/${__MODNAME}/include")
endforeach()
endif()
# For OpenCV built as static libs, we need the user to link against
# many more dependencies:
IF (NOT OpenCV_SHARED)
# Under static libs, the user of OpenCV needs access to the 3rdparty libs as well:
LINK_DIRECTORIES(@CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE@)
set(OpenCV_LIBS @OPENCV_LINKER_LIBS@ @IPP_LIBS@ @HIGHGUI_LIBRARIES@ ${OpenCV_LIBS})
set(OpenCV_EXTRA_COMPONENTS @JPEG_LIBRARIES@ @PNG_LIBRARIES@ @TIFF_LIBRARIES@ @JASPER_LIBRARIES@ @ZLIB_LIBRARY@)
if (WIN32 AND ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 2.4)
# Modern CMake:
foreach(__EXTRA_LIB ${OpenCV_EXTRA_COMPONENTS})
set(OpenCV_LIBS ${OpenCV_LIBS}
debug ${__EXTRA_LIB}@OPENCV_DEBUG_POSTFIX@
optimized ${__EXTRA_LIB})
endforeach()
else()
# Old CMake:
set(OpenCV_LIBS ${OpenCV_LIBS} ${OpenCV_EXTRA_COMPONENTS})
endif()
if (APPLE)
set(OpenCV_LIBS ${OpenCV_LIBS} "-lbz2" "-framework Cocoa" "-framework QuartzCore" "-framework QTKit")
endif()
ENDIF()
# ======================================================
# Android camera helper macro
# ======================================================
IF (OpenCV_HAVE_ANDROID_CAMERA)
macro( COPY_NATIVE_CAMERA_LIBS target )
get_target_property(target_location ${target} LOCATION)
get_filename_component(target_location "${target_location}" PATH)
file(GLOB camera_wrappers "${OpenCV_LIB_DIR}/libnative_camera_r*.so")
foreach(wrapper ${camera_wrappers})
ADD_CUSTOM_COMMAND(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${wrapper}" "${target_location}"
)
endforeach()
endmacro()
ENDIF()
# ======================================================
# Version variables:
# ======================================================
SET(OpenCV_VERSION @OPENCV_VERSION@)
SET(OpenCV_VERSION_MAJOR @OPENCV_VERSION_MAJOR@)
SET(OpenCV_VERSION_MINOR @OPENCV_VERSION_MINOR@)
SET(OpenCV_VERSION_PATCH @OPENCV_VERSION_PATCH@)