|
|
@ -14,6 +14,10 @@ |
|
|
|
# |
|
|
|
# |
|
|
|
# find_package(OpenCV REQUIRED core videoio) |
|
|
|
# find_package(OpenCV REQUIRED core videoio) |
|
|
|
# |
|
|
|
# |
|
|
|
|
|
|
|
# You can also mark OpenCV components as optional: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# find_package(OpenCV REQUIRED core OPTIONAL_COMPONENTS viz) |
|
|
|
|
|
|
|
# |
|
|
|
# If the module is found then OPENCV_<MODULE>_FOUND is set to TRUE. |
|
|
|
# If the module is found then OPENCV_<MODULE>_FOUND is set to TRUE. |
|
|
|
# |
|
|
|
# |
|
|
|
# This file will define the following variables: |
|
|
|
# This file will define the following variables: |
|
|
@ -48,6 +52,21 @@ SET(OpenCV_VERSION_PATCH @OPENCV_VERSION_PATCH@) |
|
|
|
SET(OpenCV_VERSION_TWEAK 0) |
|
|
|
SET(OpenCV_VERSION_TWEAK 0) |
|
|
|
SET(OpenCV_VERSION_STATUS "@OPENCV_VERSION_STATUS@") |
|
|
|
SET(OpenCV_VERSION_STATUS "@OPENCV_VERSION_STATUS@") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(NOT CMAKE_VERSION VERSION_LESS 2.8.8 |
|
|
|
|
|
|
|
AND OpenCV_FIND_COMPONENTS # prevent excessive output |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
# HANDLE_COMPONENTS was introduced in CMake 2.8.8 |
|
|
|
|
|
|
|
list(APPEND _OpenCV_FPHSA_ARGS HANDLE_COMPONENTS) |
|
|
|
|
|
|
|
# The missing components will be handled by the FindPackageHandleStandardArgs |
|
|
|
|
|
|
|
# module. |
|
|
|
|
|
|
|
set(_OpenCV_HANDLE_COMPONENTS_MANUALLY FALSE) |
|
|
|
|
|
|
|
else() |
|
|
|
|
|
|
|
# The missing components will be handled by this config. |
|
|
|
|
|
|
|
set(_OpenCV_HANDLE_COMPONENTS_MANUALLY TRUE) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
# Extract directory name from full path of the file currently being processed. |
|
|
|
# Extract directory name from full path of the file currently being processed. |
|
|
|
# Note that CMake 2.8.3 introduced CMAKE_CURRENT_LIST_DIR. We reimplement it |
|
|
|
# Note that CMake 2.8.3 introduced CMAKE_CURRENT_LIST_DIR. We reimplement it |
|
|
|
# for older versions of CMake to support these as well. |
|
|
|
# for older versions of CMake to support these as well. |
|
|
@ -120,24 +139,33 @@ endif() |
|
|
|
set(OpenCV_WORLD_COMPONENTS @OPENCV_WORLD_MODULES@) |
|
|
|
set(OpenCV_WORLD_COMPONENTS @OPENCV_WORLD_MODULES@) |
|
|
|
|
|
|
|
|
|
|
|
# expand short module names and see if requested components exist |
|
|
|
# expand short module names and see if requested components exist |
|
|
|
set(OpenCV_FIND_COMPONENTS_ "") |
|
|
|
|
|
|
|
foreach(__cvcomponent ${OpenCV_FIND_COMPONENTS}) |
|
|
|
foreach(__cvcomponent ${OpenCV_FIND_COMPONENTS}) |
|
|
|
|
|
|
|
# Store the name of the original component so we can set the |
|
|
|
|
|
|
|
# OpenCV_<component>_FOUND variable which can be checked by the user. |
|
|
|
|
|
|
|
set (__original_cvcomponent ${__cvcomponent}) |
|
|
|
if(NOT __cvcomponent MATCHES "^opencv_") |
|
|
|
if(NOT __cvcomponent MATCHES "^opencv_") |
|
|
|
set(__cvcomponent opencv_${__cvcomponent}) |
|
|
|
set(__cvcomponent opencv_${__cvcomponent}) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
list(FIND OpenCV_LIB_COMPONENTS ${__cvcomponent} __cvcomponentIdx) |
|
|
|
list(FIND OpenCV_LIB_COMPONENTS ${__cvcomponent} __cvcomponentIdx) |
|
|
|
if(__cvcomponentIdx LESS 0) |
|
|
|
if(__cvcomponentIdx LESS 0) |
|
|
|
#requested component is not found... |
|
|
|
if(_OpenCV_HANDLE_COMPONENTS_MANUALLY) |
|
|
|
if(OpenCV_FIND_REQUIRED) |
|
|
|
# Either the component is required or the user did not set any components at |
|
|
|
|
|
|
|
# all. In the latter case, the OpenCV_FIND_REQUIRED_<component> variable |
|
|
|
|
|
|
|
# will not be defined since it is not set by this config. So let's assume |
|
|
|
|
|
|
|
# the implicitly set components are always required. |
|
|
|
|
|
|
|
if(NOT DEFINED OpenCV_FIND_REQUIRED_${__original_cvcomponent} OR |
|
|
|
|
|
|
|
OpenCV_FIND_REQUIRED_${__original_cvcomponent}) |
|
|
|
message(FATAL_ERROR "${__cvcomponent} is required but was not found") |
|
|
|
message(FATAL_ERROR "${__cvcomponent} is required but was not found") |
|
|
|
elseif(NOT OpenCV_FIND_QUIETLY) |
|
|
|
elseif(NOT OpenCV_FIND_QUIETLY) |
|
|
|
message(WARNING "${__cvcomponent} is required but was not found") |
|
|
|
# The component was marked as optional using OPTIONAL_COMPONENTS |
|
|
|
|
|
|
|
message(WARNING "Optional component ${__cvcomponent} was not found") |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
endif(_OpenCV_HANDLE_COMPONENTS_MANUALLY) |
|
|
|
#indicate that module is NOT found |
|
|
|
#indicate that module is NOT found |
|
|
|
string(TOUPPER "${__cvcomponent}" __cvcomponentUP) |
|
|
|
string(TOUPPER "${__cvcomponent}" __cvcomponentUP) |
|
|
|
set(${__cvcomponentUP}_FOUND "${__cvcomponentUP}_FOUND-NOTFOUND") |
|
|
|
set(${__cvcomponentUP}_FOUND "${__cvcomponentUP}_FOUND-NOTFOUND") |
|
|
|
|
|
|
|
set(OpenCV_${__original_cvcomponent}_FOUND FALSE) |
|
|
|
else() |
|
|
|
else() |
|
|
|
list(APPEND OpenCV_FIND_COMPONENTS_ ${__cvcomponent}) |
|
|
|
|
|
|
|
# Not using list(APPEND) here, because OpenCV_LIBS may not exist yet. |
|
|
|
# Not using list(APPEND) here, because OpenCV_LIBS may not exist yet. |
|
|
|
# Also not clearing OpenCV_LIBS anywhere, so that multiple calls |
|
|
|
# Also not clearing OpenCV_LIBS anywhere, so that multiple calls |
|
|
|
# to find_package(OpenCV) with different component lists add up. |
|
|
|
# to find_package(OpenCV) with different component lists add up. |
|
|
@ -145,6 +173,7 @@ foreach(__cvcomponent ${OpenCV_FIND_COMPONENTS}) |
|
|
|
#indicate that module is found |
|
|
|
#indicate that module is found |
|
|
|
string(TOUPPER "${__cvcomponent}" __cvcomponentUP) |
|
|
|
string(TOUPPER "${__cvcomponent}" __cvcomponentUP) |
|
|
|
set(${__cvcomponentUP}_FOUND 1) |
|
|
|
set(${__cvcomponentUP}_FOUND 1) |
|
|
|
|
|
|
|
set(OpenCV_${__original_cvcomponent}_FOUND TRUE) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
if(OpenCV_SHARED AND ";${OpenCV_WORLD_COMPONENTS};" MATCHES ";${__cvcomponent};" AND NOT TARGET ${__cvcomponent}) |
|
|
|
if(OpenCV_SHARED AND ";${OpenCV_WORLD_COMPONENTS};" MATCHES ";${__cvcomponent};" AND NOT TARGET ${__cvcomponent}) |
|
|
|
get_target_property(__implib_dbg opencv_world IMPORTED_IMPLIB_DEBUG) |
|
|
|
get_target_property(__implib_dbg opencv_world IMPORTED_IMPLIB_DEBUG) |
|
|
@ -170,7 +199,6 @@ foreach(__cvcomponent ${OpenCV_FIND_COMPONENTS}) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endforeach() |
|
|
|
endforeach() |
|
|
|
set(OpenCV_FIND_COMPONENTS ${OpenCV_FIND_COMPONENTS_}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ============================================================== |
|
|
|
# ============================================================== |
|
|
|
# Compatibility stuff |
|
|
|
# Compatibility stuff |
|
|
@ -226,3 +254,8 @@ macro(ocv_list_filterout lst regex) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endforeach() |
|
|
|
endforeach() |
|
|
|
endmacro() |
|
|
|
endmacro() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# We do not actually need REQUIRED_VARS to be checked for. Just use the |
|
|
|
|
|
|
|
# installation directory for the status. |
|
|
|
|
|
|
|
find_package_handle_standard_args(OpenCV REQUIRED_VARS OpenCV_INSTALL_PATH |
|
|
|
|
|
|
|
VERSION_VAR OpenCV_VERSION ${_OpenCV_FPHSA_ARGS}) |
|
|
|