cmake: refactoring of OpenCVConfig

- removed OpenCV_LIB_DIR* vars (they are broken and not required anymore)
- OpenCVConfig.cmake doesn't contain ANDROID/CUDA code if there is no such support
- removed OpenCV2_INCLUDE_DIRS_CONFIGCMAKE, merged into OpenCV_INCLUDE_DIRS_CONFIGCMAKE
- fix hard-coded relative paths for OpenCV_INSTALL_PATH
- removed OpenCV_TBB_ARCH
- switch OpenCVConfig.cmake into 2-level mode for Android SDK
pull/5980/head
Alexander Alekhin 9 years ago
parent 7188e6e2ac
commit c6c651212c
  1. 118
      CMakeLists.txt
  2. 2
      cmake/OpenCVFindIPP.cmake
  3. 148
      cmake/OpenCVGenConfig.cmake
  4. 28
      cmake/OpenCVUtils.cmake
  5. 13
      cmake/templates/OpenCVConfig-ANDROID.cmake.in
  6. 53
      cmake/templates/OpenCVConfig-CUDA.cmake.in
  7. 7
      cmake/templates/OpenCVConfig-IPPICV.cmake.in
  8. 246
      cmake/templates/OpenCVConfig.cmake.in
  9. 50
      cmake/templates/OpenCVConfig.root-ANDROID.cmake.in
  10. 50
      cmake/templates/OpenCVConfig.root-WIN32.cmake.in

@ -86,8 +86,10 @@ if (POLICY CMP0042)
cmake_policy(SET CMP0042 OLD) cmake_policy(SET CMP0042 OLD)
endif() endif()
include(cmake/OpenCVUtils.cmake)
# must go before the project command # must go before the project command
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE) ocv_update(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
if(DEFINED CMAKE_BUILD_TYPE) if(DEFINED CMAKE_BUILD_TYPE)
set_property( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} ) set_property( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} )
endif() endif()
@ -100,8 +102,6 @@ if(MSVC)
set(CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE) set(CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE)
endif() endif()
include(cmake/OpenCVUtils.cmake)
ocv_cmake_eval(DEBUG_PRE ONCE) ocv_cmake_eval(DEBUG_PRE ONCE)
ocv_clear_vars(OpenCVModules_TARGETS) ocv_clear_vars(OpenCVModules_TARGETS)
@ -304,50 +304,50 @@ include(cmake/OpenCVVersion.cmake)
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Save libs and executables in the same place # Save libs and executables in the same place
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Output directory for applications" ) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Output directory for applications")
if (ANDROID) if(ANDROID)
if (ANDROID_ABI MATCHES "NEON") if(ANDROID_ABI MATCHES "NEON")
set(ENABLE_NEON ON) set(ENABLE_NEON ON)
endif() endif()
if (ANDROID_ABI MATCHES "VFPV3") if(ANDROID_ABI MATCHES "VFPV3")
set(ENABLE_VFPV3 ON) set(ENABLE_VFPV3 ON)
endif() endif()
endif() endif()
if(ANDROID OR WIN32) if(ANDROID OR WIN32)
set(OPENCV_DOC_INSTALL_PATH doc) ocv_update(OPENCV_DOC_INSTALL_PATH doc)
else() else()
set(OPENCV_DOC_INSTALL_PATH share/OpenCV/doc) ocv_update(OPENCV_DOC_INSTALL_PATH share/OpenCV/doc)
endif() endif()
if(WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows) if(WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
if(DEFINED OpenCV_RUNTIME AND DEFINED OpenCV_ARCH) if(DEFINED OpenCV_RUNTIME AND DEFINED OpenCV_ARCH)
set(OpenCV_INSTALL_BINARIES_PREFIX "${OpenCV_ARCH}/${OpenCV_RUNTIME}/") ocv_update(OpenCV_INSTALL_BINARIES_PREFIX "${OpenCV_ARCH}/${OpenCV_RUNTIME}/")
else() else()
message(STATUS "Can't detect runtime and/or arch") message(STATUS "Can't detect runtime and/or arch")
set(OpenCV_INSTALL_BINARIES_PREFIX "") ocv_update(OpenCV_INSTALL_BINARIES_PREFIX "")
endif() endif()
elseif(ANDROID) elseif(ANDROID)
set(OpenCV_INSTALL_BINARIES_PREFIX "sdk/native/") ocv_update(OpenCV_INSTALL_BINARIES_PREFIX "sdk/native/")
else() else()
set(OpenCV_INSTALL_BINARIES_PREFIX "") ocv_update(OpenCV_INSTALL_BINARIES_PREFIX "")
endif() endif()
if(ANDROID) if(ANDROID)
set(OPENCV_SAMPLES_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}samples/${ANDROID_NDK_ABI_NAME}") ocv_update(OPENCV_SAMPLES_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}samples/${ANDROID_NDK_ABI_NAME}")
else() else()
set(OPENCV_SAMPLES_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}samples") ocv_update(OPENCV_SAMPLES_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}samples")
endif() endif()
if(ANDROID) if(ANDROID)
set(OPENCV_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}bin/${ANDROID_NDK_ABI_NAME}") ocv_update(OPENCV_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}bin/${ANDROID_NDK_ABI_NAME}")
else() else()
set(OPENCV_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}bin") ocv_update(OPENCV_BIN_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}bin")
endif() endif()
if(NOT OPENCV_TEST_INSTALL_PATH) if(NOT OPENCV_TEST_INSTALL_PATH)
set(OPENCV_TEST_INSTALL_PATH "${OPENCV_BIN_INSTALL_PATH}") ocv_update(OPENCV_TEST_INSTALL_PATH "${OPENCV_BIN_INSTALL_PATH}")
endif() endif()
if (OPENCV_TEST_DATA_PATH) if (OPENCV_TEST_DATA_PATH)
@ -356,66 +356,74 @@ endif()
if(OPENCV_TEST_DATA_PATH AND NOT OPENCV_TEST_DATA_INSTALL_PATH) if(OPENCV_TEST_DATA_PATH AND NOT OPENCV_TEST_DATA_INSTALL_PATH)
if(ANDROID) if(ANDROID)
set(OPENCV_TEST_DATA_INSTALL_PATH "sdk/etc/testdata") ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "sdk/etc/testdata")
elseif(WIN32) elseif(WIN32)
set(OPENCV_TEST_DATA_INSTALL_PATH "testdata") ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "testdata")
else() else()
set(OPENCV_TEST_DATA_INSTALL_PATH "share/OpenCV/testdata") ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "share/OpenCV/testdata")
endif() endif()
endif() endif()
if(ANDROID) if(ANDROID)
set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib/${ANDROID_NDK_ABI_NAME}") set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib/${ANDROID_NDK_ABI_NAME}")
set(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib/${ANDROID_NDK_ABI_NAME}") ocv_update(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib/${ANDROID_NDK_ABI_NAME}")
set(OPENCV_LIB_INSTALL_PATH sdk/native/libs/${ANDROID_NDK_ABI_NAME}) ocv_update(OPENCV_LIB_INSTALL_PATH sdk/native/libs/${ANDROID_NDK_ABI_NAME})
set(OPENCV_3P_LIB_INSTALL_PATH sdk/native/3rdparty/libs/${ANDROID_NDK_ABI_NAME}) ocv_update(OPENCV_3P_LIB_INSTALL_PATH sdk/native/3rdparty/libs/${ANDROID_NDK_ABI_NAME})
set(OPENCV_CONFIG_INSTALL_PATH sdk/native/jni) ocv_update(OPENCV_CONFIG_INSTALL_PATH sdk/native/jni)
set(OPENCV_INCLUDE_INSTALL_PATH sdk/native/jni/include) ocv_update(OPENCV_INCLUDE_INSTALL_PATH sdk/native/jni/include)
set(OPENCV_SAMPLES_SRC_INSTALL_PATH samples/native) ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH samples/native)
set(OPENCV_OTHER_INSTALL_PATH sdk/etc) ocv_update(OPENCV_OTHER_INSTALL_PATH sdk/etc)
else() else()
set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib") set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib")
set(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib${LIB_SUFFIX}") ocv_update(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib${LIB_SUFFIX}")
if(WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows) if(WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
if(OpenCV_STATIC) if(OpenCV_STATIC)
set(OPENCV_LIB_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib${LIB_SUFFIX}") ocv_update(OPENCV_LIB_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib${LIB_SUFFIX}")
else() else()
set(OPENCV_LIB_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}lib${LIB_SUFFIX}") ocv_update(OPENCV_LIB_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}lib${LIB_SUFFIX}")
endif() endif()
set(OPENCV_3P_LIB_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib${LIB_SUFFIX}") ocv_update(OPENCV_3P_LIB_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib${LIB_SUFFIX}")
set(OPENCV_SAMPLES_SRC_INSTALL_PATH samples/native) ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH samples/native)
set(OPENCV_JAR_INSTALL_PATH java) ocv_update(OPENCV_JAR_INSTALL_PATH java)
set(OPENCV_OTHER_INSTALL_PATH etc) ocv_update(OPENCV_OTHER_INSTALL_PATH etc)
ocv_update(OPENCV_CONFIG_INSTALL_PATH "")
else() else()
set(OPENCV_LIB_INSTALL_PATH lib${LIB_SUFFIX}) ocv_update(OPENCV_LIB_INSTALL_PATH lib${LIB_SUFFIX})
set(OPENCV_3P_LIB_INSTALL_PATH share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}) ocv_update(OPENCV_3P_LIB_INSTALL_PATH share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH})
set(OPENCV_SAMPLES_SRC_INSTALL_PATH share/OpenCV/samples) ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH share/OpenCV/samples)
set(OPENCV_JAR_INSTALL_PATH share/OpenCV/java) ocv_update(OPENCV_JAR_INSTALL_PATH share/OpenCV/java)
set(OPENCV_OTHER_INSTALL_PATH share/OpenCV) ocv_update(OPENCV_OTHER_INSTALL_PATH share/OpenCV)
endif()
set(OPENCV_INCLUDE_INSTALL_PATH "include")
if(NOT DEFINED OPENCV_CONFIG_INSTALL_PATH)
math(EXPR SIZEOF_VOID_P_BITS "8 * ${CMAKE_SIZEOF_VOID_P}") math(EXPR SIZEOF_VOID_P_BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
if(LIB_SUFFIX AND NOT SIZEOF_VOID_P_BITS EQUAL LIB_SUFFIX) if(LIB_SUFFIX AND NOT SIZEOF_VOID_P_BITS EQUAL LIB_SUFFIX)
set(OPENCV_CONFIG_INSTALL_PATH lib${LIB_SUFFIX}/cmake/opencv) ocv_update(OPENCV_CONFIG_INSTALL_PATH lib${LIB_SUFFIX}/cmake/opencv)
else() else()
set(OPENCV_CONFIG_INSTALL_PATH share/OpenCV) ocv_update(OPENCV_CONFIG_INSTALL_PATH share/OpenCV)
endif() endif()
endif()
endif()
ocv_update(OPENCV_INCLUDE_INSTALL_PATH "include")
endif() endif()
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}") ocv_update(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
if(INSTALL_TO_MANGLED_PATHS) if(INSTALL_TO_MANGLED_PATHS)
set(OPENCV_INCLUDE_INSTALL_PATH ${OPENCV_INCLUDE_INSTALL_PATH}/opencv-${OPENCV_VERSION}) set(OPENCV_INCLUDE_INSTALL_PATH ${OPENCV_INCLUDE_INSTALL_PATH}/opencv-${OPENCV_VERSION})
string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" OPENCV_3P_LIB_INSTALL_PATH "${OPENCV_3P_LIB_INSTALL_PATH}") foreach(v
string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" OPENCV_SAMPLES_SRC_INSTALL_PATH "${OPENCV_SAMPLES_SRC_INSTALL_PATH}") OPENCV_3P_LIB_INSTALL_PATH
string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" OPENCV_CONFIG_INSTALL_PATH "${OPENCV_CONFIG_INSTALL_PATH}") OPENCV_SAMPLES_SRC_INSTALL_PATH
string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" OPENCV_DOC_INSTALL_PATH "${OPENCV_DOC_INSTALL_PATH}") OPENCV_CONFIG_INSTALL_PATH
string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" OPENCV_JAR_INSTALL_PATH "${OPENCV_JAR_INSTALL_PATH}") OPENCV_DOC_INSTALL_PATH
string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" OPENCV_TEST_DATA_INSTALL_PATH "${OPENCV_TEST_DATA_INSTALL_PATH}") OPENCV_JAR_INSTALL_PATH
string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" OPENCV_OTHER_INSTALL_PATH "${OPENCV_OTHER_INSTALL_PATH}") OPENCV_TEST_DATA_INSTALL_PATH
OPENCV_OTHER_INSTALL_PATH
)
string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" ${v} "${${v}}")
string(REPLACE "opencv" "opencv-${OPENCV_VERSION}" ${v} "${${v}}")
endforeach()
endif() endif()
@ -440,7 +448,7 @@ endif()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Path for build/platform -specific headers # Path for build/platform -specific headers
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
set(OPENCV_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/" CACHE PATH "Where to create the platform-dependant cvconfig.h") ocv_update(OPENCV_CONFIG_FILE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/" CACHE PATH "Where to create the platform-dependant cvconfig.h")
ocv_include_directories(${OPENCV_CONFIG_FILE_INCLUDE_DIR}) ocv_include_directories(${OPENCV_CONFIG_FILE_INCLUDE_DIR})
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@ -453,7 +461,7 @@ set(OPENCV_EXTRA_MODULES_PATH "" CACHE PATH "Where to look for additional OpenCV
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
find_host_package(Git QUIET) find_host_package(Git QUIET)
if(GIT_FOUND) if(NOT DEFINED OPENCV_VCSVERSION AND GIT_FOUND)
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --always --dirty --match "[0-9].[0-9].[0-9]*" execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --always --dirty --match "[0-9].[0-9].[0-9]*"
WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}" WORKING_DIRECTORY "${OpenCV_SOURCE_DIR}"
OUTPUT_VARIABLE OPENCV_VCSVERSION OUTPUT_VARIABLE OPENCV_VCSVERSION
@ -464,7 +472,7 @@ if(GIT_FOUND)
if(NOT GIT_RESULT EQUAL 0) if(NOT GIT_RESULT EQUAL 0)
set(OPENCV_VCSVERSION "unknown") set(OPENCV_VCSVERSION "unknown")
endif() endif()
else() elseif(NOT DEFINED OPENCV_VCSVERSION)
# We don't have git: # We don't have git:
set(OPENCV_VCSVERSION "unknown") set(OPENCV_VCSVERSION "unknown")
endif() endif()

@ -146,7 +146,7 @@ macro(ipp_detect_version)
IMPORTED_LOCATION ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX} IMPORTED_LOCATION ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
) )
list(APPEND IPP_LIBRARIES ipp${name}) list(APPEND IPP_LIBRARIES ipp${name})
if (NOT BUILD_SHARED_LIBS OR NOT INSTALL_CREATE_DISTRIB) if (NOT BUILD_SHARED_LIBS)
# CMake doesn't support "install(TARGETS ${IPP_PREFIX}${name} " command with imported targets # CMake doesn't support "install(TARGETS ${IPP_PREFIX}${name} " command with imported targets
install(FILES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX} install(FILES ${IPP_LIBRARY_DIR}/${IPP_LIB_PREFIX}${IPP_PREFIX}${name}${IPP_SUFFIX}${IPP_LIB_SUFFIX}
DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev) DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)

@ -11,47 +11,20 @@ else()
set(OpenCV_USE_MANGLED_PATHS_CONFIGCMAKE FALSE) set(OpenCV_USE_MANGLED_PATHS_CONFIGCMAKE FALSE)
endif() endif()
if(NOT OpenCV_CUDA_CC) if(HAVE_CUDA)
set(OpenCV_CUDA_CC_CONFIGCMAKE "\"\"") ocv_cmake_configure("${CMAKE_CURRENT_LIST_DIR}/templates/OpenCVConfig-CUDA.cmake.in" CUDA_CONFIGCMAKE @ONLY)
set(OpenCV_CUDA_VERSION "")
else()
set(OpenCV_CUDA_CC_CONFIGCMAKE "${OpenCV_CUDA_CC}")
set(OpenCV_CUDA_VERSION ${CUDA_VERSION_STRING})
endif() endif()
if(NOT ANDROID_NATIVE_API_LEVEL) if(ANDROID)
if(NOT ANDROID_NATIVE_API_LEVEL)
set(OpenCV_ANDROID_NATIVE_API_LEVEL_CONFIGCMAKE 0) set(OpenCV_ANDROID_NATIVE_API_LEVEL_CONFIGCMAKE 0)
else()
set(OpenCV_ANDROID_NATIVE_API_LEVEL_CONFIGCMAKE "${ANDROID_NATIVE_API_LEVEL}")
endif()
if(CMAKE_GENERATOR MATCHES "Visual" OR CMAKE_GENERATOR MATCHES "Xcode")
set(OpenCV_ADD_DEBUG_RELEASE_CONFIGCMAKE TRUE)
else()
set(OpenCV_ADD_DEBUG_RELEASE_CONFIGCMAKE FALSE)
endif()
if(WIN32)
if(MINGW)
set(OPENCV_LINK_LIBRARY_SUFFIX ".dll.a")
else() else()
set(OPENCV_LINK_LIBRARY_SUFFIX ".lib") set(OpenCV_ANDROID_NATIVE_API_LEVEL_CONFIGCMAKE "${ANDROID_NATIVE_API_LEVEL}")
endif() endif()
ocv_cmake_configure("${CMAKE_CURRENT_LIST_DIR}/templates/OpenCVConfig-ANDROID.cmake.in" ANDROID_CONFIGCMAKE @ONLY)
endif() endif()
#build list of modules available for the OpenCV user set(OPENCV_MODULES_CONFIGCMAKE ${OPENCV_MODULES_PUBLIC})
set(OpenCV_LIB_COMPONENTS "")
foreach(m ${OPENCV_MODULES_PUBLIC})
list(INSERT OpenCV_LIB_COMPONENTS 0 ${${m}_MODULE_DEPS_OPT} ${m})
endforeach()
ocv_list_unique(OpenCV_LIB_COMPONENTS)
set(OPENCV_MODULES_CONFIGCMAKE ${OpenCV_LIB_COMPONENTS})
ocv_list_filterout(OpenCV_LIB_COMPONENTS "^opencv_")
if(OpenCV_LIB_COMPONENTS)
list(REMOVE_ITEM OPENCV_MODULES_CONFIGCMAKE ${OpenCV_LIB_COMPONENTS})
endif()
if(BUILD_FAT_JAVA_LIB AND HAVE_opencv_java) if(BUILD_FAT_JAVA_LIB AND HAVE_opencv_java)
list(APPEND OPENCV_MODULES_CONFIGCMAKE opencv_java) list(APPEND OPENCV_MODULES_CONFIGCMAKE opencv_java)
@ -62,33 +35,20 @@ endif()
# ------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------
set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"${OPENCV_CONFIG_FILE_INCLUDE_DIR}\" \"${OpenCV_SOURCE_DIR}/include\" \"${OpenCV_SOURCE_DIR}/include/opencv\"") set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"${OPENCV_CONFIG_FILE_INCLUDE_DIR}\" \"${OpenCV_SOURCE_DIR}/include\" \"${OpenCV_SOURCE_DIR}/include/opencv\"")
set(OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "")
foreach(m ${OPENCV_MODULES_BUILD}) foreach(m ${OPENCV_MODULES_BUILD})
if(EXISTS "${OPENCV_MODULE_${m}_LOCATION}/include") if(EXISTS "${OPENCV_MODULE_${m}_LOCATION}/include")
list(APPEND OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "${OPENCV_MODULE_${m}_LOCATION}/include") set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "${OpenCV_INCLUDE_DIRS_CONFIGCMAKE} \"${OPENCV_MODULE_${m}_LOCATION}/include\"")
endif() endif()
endforeach() endforeach()
if(ANDROID AND NOT BUILD_SHARED_LIBS AND HAVE_TBB) export(TARGETS ${OpenCVModules_TARGETS} FILE "${CMAKE_BINARY_DIR}/OpenCVModules.cmake")
#export TBB headers location because static linkage of TBB might be troublesome if application wants to use TBB itself
list(APPEND OpenCV2_INCLUDE_DIRS_CONFIGCMAKE ${TBB_INCLUDE_DIRS})
endif()
set(modules_file_suffix "")
if(ANDROID)
# the REPLACE here is needed, because OpenCVModules_armeabi.cmake includes
# OpenCVModules_armeabi-*.cmake, which would match OpenCVModules_armeabi-v7a*.cmake.
string(REPLACE - _ modules_file_suffix "_${ANDROID_NDK_ABI_NAME}")
endif()
export(TARGETS ${OpenCVModules_TARGETS} FILE "${CMAKE_BINARY_DIR}/OpenCVModules${modules_file_suffix}.cmake")
if(TARGET ippicv AND (NOT BUILD_SHARED_LIBS OR NOT INSTALL_CREATE_DISTRIB)) if(TARGET ippicv AND NOT BUILD_SHARED_LIBS)
set(USE_IPPICV TRUE) set(USE_IPPICV TRUE)
file(RELATIVE_PATH INSTALL_PATH_RELATIVE_IPPICV ${CMAKE_BINARY_DIR} ${IPPICV_LOCATION_PATH}) file(RELATIVE_PATH IPPICV_INSTALL_PATH_RELATIVE_CONFIGCMAKE ${CMAKE_BINARY_DIR} ${IPPICV_LOCATION_PATH})
ocv_cmake_configure("${CMAKE_CURRENT_LIST_DIR}/templates/OpenCVConfig-IPPICV.cmake.in" IPPICV_CONFIGCMAKE @ONLY)
else() else()
set(USE_IPPICV FALSE) set(USE_IPPICV FALSE)
set(INSTALL_PATH_RELATIVE_IPPICV "non-existed-path")
endif() endif()
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig.cmake" @ONLY) configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig.cmake" @ONLY)
@ -98,58 +58,60 @@ configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.
# -------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------
# Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use *with* "make install" # Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use *with* "make install"
# ------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------
set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}/opencv" "\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}\"") file(RELATIVE_PATH OpenCV_INSTALL_PATH_RELATIVE_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/${OPENCV_CONFIG_INSTALL_PATH}/" ${CMAKE_INSTALL_PREFIX})
set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}\" \"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}/opencv\"")
set(OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "\"\"")
set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_3P_LIB_INSTALL_PATH}\"") if(USE_IPPICV)
file(RELATIVE_PATH IPPICV_INSTALL_PATH_RELATIVE_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}" ${IPPICV_INSTALL_PATH})
if(UNIX) # ANDROID configuration is created here also ocv_cmake_configure("${CMAKE_CURRENT_LIST_DIR}/templates/OpenCVConfig-IPPICV.cmake.in" IPPICV_CONFIGCMAKE @ONLY)
#http://www.vtk.org/Wiki/CMake/Tutorials/Packaging reference endif()
# For a command "find_package(<name> [major[.minor]] [EXACT] [REQUIRED|QUIET])"
# cmake will look in the following dir on unix: function(ocv_gen_config TMP_DIR NESTED_PATH ROOT_NAME)
# <prefix>/(share|lib)/cmake/<name>*/ (U) ocv_path_join(__install_nested "${OPENCV_CONFIG_INSTALL_PATH}" "${NESTED_PATH}")
# <prefix>/(share|lib)/<name>*/ (U) ocv_path_join(__tmp_nested "${TMP_DIR}" "${NESTED_PATH}")
# <prefix>/(share|lib)/<name>*/(cmake|CMake)/ (U)
if(USE_IPPICV) file(RELATIVE_PATH OpenCV_INSTALL_PATH_RELATIVE_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/${__install_nested}" "${CMAKE_INSTALL_PREFIX}/")
file(RELATIVE_PATH INSTALL_PATH_RELATIVE_IPPICV "${CMAKE_INSTALL_PREFIX}/${OPENCV_CONFIG_INSTALL_PATH}/" ${IPPICV_INSTALL_PATH})
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${TMP_DIR}/OpenCVConfig-version.cmake" @ONLY)
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${__tmp_nested}/OpenCVConfig.cmake" @ONLY)
install(EXPORT OpenCVModules DESTINATION "${__install_nested}" FILE OpenCVModules.cmake COMPONENT dev)
install(FILES
"${TMP_DIR}/OpenCVConfig-version.cmake"
"${__tmp_nested}/OpenCVConfig.cmake"
DESTINATION "${CMAKE_INSTALL_PREFIX}/${__install_nested}" COMPONENT dev)
if(ROOT_NAME)
# Root config file
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/${ROOT_NAME}" "${TMP_DIR}/OpenCVConfig.cmake" @ONLY)
install(FILES
"${TMP_DIR}/OpenCVConfig-version.cmake"
"${TMP_DIR}/OpenCVConfig.cmake"
DESTINATION "${CMAKE_INSTALL_PREFIX}/${OPENCV_CONFIG_INSTALL_PATH}" COMPONENT dev)
endif() endif()
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" @ONLY) endfunction()
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ COMPONENT dev) if(UNIX AND NOT ANDROID)
install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ COMPONENT dev) ocv_gen_config("${CMAKE_BINARY_DIR}/unix-install" "" "")
install(EXPORT OpenCVModules DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev)
endif() endif()
if(ANDROID) if(ANDROID)
install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/android.toolchain.cmake" DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ COMPONENT dev) ocv_gen_config("${CMAKE_BINARY_DIR}/unix-install" "abi-${ANDROID_NDK_ABI_NAME}" "OpenCVConfig.root-ANDROID.cmake.in")
install(FILES "${OpenCV_SOURCE_DIR}/platforms/android/android.toolchain.cmake" DESTINATION "${OPENCV_CONFIG_INSTALL_PATH}" COMPONENT dev)
endif() endif()
# -------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------
# Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages # Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages
# -------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------
if(WIN32) if(WIN32)
set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_CONFIG_PATH}/include\" \"\${OpenCV_CONFIG_PATH}/include/opencv\"") if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
set(OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "\"\"")
exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/win-install/\"" OUTPUT_VARIABLE RET_VAL)
if(USE_IPPICV)
file(RELATIVE_PATH INSTALL_PATH_RELATIVE_IPPICV "${CMAKE_INSTALL_PREFIX}/${OpenCV_INSTALL_BINARIES_PREFIX}staticlib" ${IPPICV_INSTALL_PATH})
endif()
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" @ONLY)
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig-version.cmake" @ONLY)
if (CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib" COMPONENT dev) set(_lib_suffix "lib")
install(EXPORT OpenCVModules DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib" FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev) else()
set(_lib_suffix "staticlib")
endif()
ocv_gen_config("${CMAKE_BINARY_DIR}/win-install" "${OpenCV_INSTALL_BINARIES_PREFIX}${_lib_suffix}" "OpenCVConfig.root-WIN32.cmake.in")
else() else()
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib" COMPONENT dev) ocv_gen_config("${CMAKE_BINARY_DIR}/win-install" "" "")
install(EXPORT OpenCVModules DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib" FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev)
endif() endif()
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig-version.cmake" DESTINATION ./ COMPONENT dev)
install(FILES "${OpenCV_SOURCE_DIR}/cmake/OpenCVConfig.cmake" DESTINATION ./ COMPONENT dev)
else ()
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib/cmake/opencv-${OPENCV_VERSION}" COMPONENT dev)
install(EXPORT OpenCVModules DESTINATION "${OpenCV_INSTALL_BINARIES_PREFIX}lib/cmake/opencv-${OPENCV_VERSION}" FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev)
install(FILES "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig-version.cmake" DESTINATION "lib/cmake/opencv-${OPENCV_VERSION}" COMPONENT dev)
endif ()
endif() endif()

@ -30,6 +30,19 @@ function(ocv_cmake_eval var_name)
endif() endif()
endfunction() endfunction()
macro(ocv_cmake_configure file_name var_name)
configure_file(${file_name} "${CMAKE_BINARY_DIR}/CMakeConfig-${var_name}.cmake" ${ARGN})
file(READ "${CMAKE_BINARY_DIR}/CMakeConfig-${var_name}.cmake" ${var_name})
endmacro()
macro(ocv_update VAR)
if(NOT DEFINED ${VAR})
set(${VAR} ${ARGN})
else()
#ocv_debug_message("Preserve old value for ${VAR}: ${${VAR}}")
endif()
endmacro()
# Search packages for host system instead of packages for target system # Search packages for host system instead of packages for target system
# in case of cross compilation thess macro should be defined by toolchain file # in case of cross compilation thess macro should be defined by toolchain file
if(NOT COMMAND find_host_package) if(NOT COMMAND find_host_package)
@ -71,6 +84,19 @@ macro(ocv_check_environment_variables)
endforeach() endforeach()
endmacro() endmacro()
macro(ocv_path_join result_var P1 P2)
string(REGEX REPLACE "^[/]+" "" P2 "${P2}")
if("${P1}" STREQUAL "")
set(${result_var} "${P2}")
elseif("${P1}" STREQUAL "/")
set(${result_var} "/${P2}")
elseif("${P2}" STREQUAL "")
set(${result_var} "${P1}")
else()
set(${result_var} "${P1}/${P2}")
endif()
endmacro()
# rename modules target to world if needed # rename modules target to world if needed
macro(_ocv_fix_target target_var) macro(_ocv_fix_target target_var)
if(BUILD_opencv_world) if(BUILD_opencv_world)
@ -359,7 +385,7 @@ macro(CHECK_MODULE module_name define)
endmacro() endmacro()
set(OPENCV_BUILD_INFO_FILE "${OpenCV_BINARY_DIR}/version_string.tmp") set(OPENCV_BUILD_INFO_FILE "${CMAKE_BINARY_DIR}/version_string.tmp")
file(REMOVE "${OPENCV_BUILD_INFO_FILE}") file(REMOVE "${OPENCV_BUILD_INFO_FILE}")
function(ocv_output_status msg) function(ocv_output_status msg)
message(STATUS "${msg}") message(STATUS "${msg}")

@ -0,0 +1,13 @@
# Android API level from which OpenCV has been compiled is remembered
set(OpenCV_ANDROID_NATIVE_API_LEVEL "@OpenCV_ANDROID_NATIVE_API_LEVEL_CONFIGCMAKE@")
# ==============================================================
# Check OpenCV availability
# ==============================================================
if(OpenCV_ANDROID_NATIVE_API_LEVEL GREATER ANDROID_NATIVE_API_LEVEL)
if(NOT OpenCV_FIND_QUIETLY)
message(WARNING "Minimum required by OpenCV API level is android-${OpenCV_ANDROID_NATIVE_API_LEVEL}")
endif()
set(OpenCV_FOUND 0)
return()
endif()

@ -0,0 +1,53 @@
# Version Compute Capability from which OpenCV has been compiled is remembered
set(OpenCV_COMPUTE_CAPABILITIES "@OpenCV_CUDA_CC@")
set(OpenCV_CUDA_VERSION "@CUDA_VERSION_STRING@")
set(OpenCV_USE_CUBLAS "@HAVE_CUBLAS@")
set(OpenCV_USE_CUFFT "@HAVE_CUFFT@")
set(OpenCV_USE_NVCUVID "@HAVE_NVCUVID@")
if(NOT CUDA_FOUND)
find_host_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
else()
if(NOT CUDA_VERSION_STRING VERSION_EQUAL OpenCV_CUDA_VERSION)
message(FATAL_ERROR "OpenCV static library was compiled with CUDA ${OpenCV_CUDA_VERSION} support. Please, use the same version or rebuild OpenCV with CUDA ${CUDA_VERSION_STRING}")
endif()
endif()
set(OpenCV_CUDA_LIBS_ABSPATH ${CUDA_LIBRARIES})
if(${CUDA_VERSION} VERSION_LESS "5.5")
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_npp_LIBRARY})
else()
find_cuda_helper_libs(nppc)
find_cuda_helper_libs(nppi)
find_cuda_helper_libs(npps)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nppc_LIBRARY} ${CUDA_nppi_LIBRARY} ${CUDA_npps_LIBRARY})
endif()
if(OpenCV_USE_CUBLAS)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUBLAS_LIBRARIES})
endif()
if(OpenCV_USE_CUFFT)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUFFT_LIBRARIES})
endif()
if(OpenCV_USE_NVCUVID)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvid_LIBRARIES})
endif()
if(WIN32)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvenc_LIBRARIES})
endif()
set(OpenCV_CUDA_LIBS_RELPATH "")
foreach(l ${OpenCV_CUDA_LIBS_ABSPATH})
get_filename_component(_tmp ${l} PATH)
if(NOT ${_tmp} MATCHES "-Wl.*")
list(APPEND OpenCV_CUDA_LIBS_RELPATH ${_tmp})
endif()
endforeach()
list(REMOVE_DUPLICATES OpenCV_CUDA_LIBS_RELPATH)
link_directories(${OpenCV_CUDA_LIBS_RELPATH})

@ -0,0 +1,7 @@
if(NOT TARGET ippicv)
add_library(ippicv STATIC IMPORTED)
set_target_properties(ippicv PROPERTIES
IMPORTED_LINK_INTERFACE_LIBRARIES ""
IMPORTED_LOCATION "${OpenCV_INSTALL_PATH}/@IPPICV_INSTALL_PATH_RELATIVE_CONFIGCMAKE@"
)
endif()

@ -29,79 +29,55 @@
# #
# Advanced variables: # Advanced variables:
# - OpenCV_SHARED : Use OpenCV as shared library # - OpenCV_SHARED : Use OpenCV as shared library
# - OpenCV_CONFIG_PATH : Path to this OpenCVConfig.cmake # - OpenCV_INSTALL_PATH : OpenCV location
# - OpenCV_INSTALL_PATH : OpenCV location (not set on Windows)
# - OpenCV_LIB_COMPONENTS : Present OpenCV modules list # - OpenCV_LIB_COMPONENTS : Present OpenCV modules list
# - OpenCV_USE_MANGLED_PATHS : Mangled OpenCV path flag # - OpenCV_USE_MANGLED_PATHS : Mangled OpenCV path flag
# - OpenCV_MODULES_SUFFIX : The suffix for OpenCVModules-XXX.cmake file
# #
# Deprecated variables: # Deprecated variables:
# - OpenCV_VERSION_TWEAK : Always "0" # - OpenCV_VERSION_TWEAK : Always "0"
# #
# =================================================================================== # ===================================================================================
# ======================================================
# Version variables:
# ======================================================
SET(OpenCV_VERSION @OPENCV_VERSION_PLAIN@)
SET(OpenCV_VERSION_MAJOR @OPENCV_VERSION_MAJOR@)
SET(OpenCV_VERSION_MINOR @OPENCV_VERSION_MINOR@)
SET(OpenCV_VERSION_PATCH @OPENCV_VERSION_PATCH@)
SET(OpenCV_VERSION_TWEAK 0)
SET(OpenCV_VERSION_STATUS "@OPENCV_VERSION_STATUS@")
# 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
# for older versions of CMake to support these as well.
if(CMAKE_VERSION VERSION_LESS "2.8.3")
get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
endif()
# Extract the directory where *this* file has been installed (determined at cmake run-time)
# Get the absolute path with no ../.. relative marks, to eliminate implicit linker warnings
set(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_DIR}")
get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/@OpenCV_INSTALL_PATH_RELATIVE_CONFIGCMAKE@" REALPATH)
# Search packages for host system instead of packages for target system. # Search packages for host system instead of packages for target system.
# in case of cross compilation thess macro should be defined by toolchain file # in case of cross compilation thess macro should be defined by toolchain file
if(NOT COMMAND find_host_package) if(NOT COMMAND find_host_package)
macro(find_host_package) macro(find_host_package)
find_package(${ARGN}) find_package(${ARGN})
endmacro() endmacro()
endif() endif()
if(NOT COMMAND find_host_program) if(NOT COMMAND find_host_program)
macro(find_host_program) macro(find_host_program)
find_program(${ARGN}) find_program(${ARGN})
endmacro() endmacro()
endif() endif()
if(NOT DEFINED OpenCV_MODULES_SUFFIX)
if(ANDROID)
string(REPLACE - _ OpenCV_MODULES_SUFFIX "_${ANDROID_NDK_ABI_NAME}")
else()
set(OpenCV_MODULES_SUFFIX "")
endif()
endif()
if("@USE_IPPICV@" STREQUAL "TRUE") # value is defined by package builder (use STREQUAL to comply new CMake policy CMP0012) @CUDA_CONFIGCMAKE@
if(NOT TARGET ippicv) @ANDROID_CONFIGCMAKE@
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_PATH_RELATIVE_IPPICV@")
add_library(ippicv STATIC IMPORTED)
set_target_properties(ippicv PROPERTIES
IMPORTED_LINK_INTERFACE_LIBRARIES ""
IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_PATH_RELATIVE_IPPICV@"
)
endif()
endif()
endif()
if(NOT TARGET opencv_core) @IPPICV_CONFIGCMAKE@
# 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
# for older versions of CMake to support these as well.
if(CMAKE_VERSION VERSION_LESS "2.8.3")
get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/OpenCVModules${OpenCV_MODULES_SUFFIX}.cmake)
endif()
# TODO All things below should be reviewed. What is about of moving this code into related modules (special vars/hooks/files)
# Version Compute Capability from which OpenCV has been compiled is remembered
set(OpenCV_COMPUTE_CAPABILITIES @OpenCV_CUDA_CC_CONFIGCMAKE@)
set(OpenCV_CUDA_VERSION @OpenCV_CUDA_VERSION@)
set(OpenCV_USE_CUBLAS @HAVE_CUBLAS@)
set(OpenCV_USE_CUFFT @HAVE_CUFFT@)
set(OpenCV_USE_NVCUVID @HAVE_NVCUVID@)
# Android API level from which OpenCV has been compiled is remembered
if(ANDROID)
set(OpenCV_ANDROID_NATIVE_API_LEVEL @OpenCV_ANDROID_NATIVE_API_LEVEL_CONFIGCMAKE@)
else()
set(OpenCV_ANDROID_NATIVE_API_LEVEL 0)
endif()
# Some additional settings are required if OpenCV is built as static libs # Some additional settings are required if OpenCV is built as static libs
set(OpenCV_SHARED @BUILD_SHARED_LIBS@) set(OpenCV_SHARED @BUILD_SHARED_LIBS@)
@ -109,77 +85,11 @@ set(OpenCV_SHARED @BUILD_SHARED_LIBS@)
# Enables mangled install paths, that help with side by side installs # Enables mangled install paths, that help with side by side installs
set(OpenCV_USE_MANGLED_PATHS @OpenCV_USE_MANGLED_PATHS_CONFIGCMAKE@) set(OpenCV_USE_MANGLED_PATHS @OpenCV_USE_MANGLED_PATHS_CONFIGCMAKE@)
# Extract the directory where *this* file has been installed (determined at cmake run-time) set(OpenCV_LIB_COMPONENTS @OPENCV_MODULES_CONFIGCMAKE@)
if(CMAKE_VERSION VERSION_LESS "2.8.12")
get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH CACHE)
else()
get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY CACHE)
endif()
if(NOT WIN32 OR ANDROID)
if(ANDROID)
set(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../../..")
else()
set(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../..")
endif()
# Get the absolute path with no ../.. relative marks, to eliminate implicit linker warnings
if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 2.8)
get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_INSTALL_PATH}" ABSOLUTE)
else()
get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_INSTALL_PATH}" REALPATH)
endif()
endif()
# ======================================================
# Include directories to add to the user project:
# ======================================================
# Provide the include directories to the caller
set(OpenCV_INCLUDE_DIRS @OpenCV_INCLUDE_DIRS_CONFIGCMAKE@) set(OpenCV_INCLUDE_DIRS @OpenCV_INCLUDE_DIRS_CONFIGCMAKE@)
# ====================================================== if(NOT TARGET opencv_core)
# Link directories to add to the user project: include(${CMAKE_CURRENT_LIST_DIR}/OpenCVModules${OpenCV_MODULES_SUFFIX}.cmake)
# ======================================================
# Provide the libs directories to the caller
set(OpenCV_LIB_DIR_OPT @OpenCV_LIB_DIRS_CONFIGCMAKE@ CACHE PATH "Path where release OpenCV libraries are located")
set(OpenCV_LIB_DIR_DBG @OpenCV_LIB_DIRS_CONFIGCMAKE@ CACHE PATH "Path where debug OpenCV libraries are located")
set(OpenCV_3RDPARTY_LIB_DIR_OPT @OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE@ CACHE PATH "Path where release 3rdparty OpenCV dependencies are located")
set(OpenCV_3RDPARTY_LIB_DIR_DBG @OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE@ CACHE PATH "Path where debug 3rdparty OpenCV dependencies are located")
mark_as_advanced(FORCE OpenCV_LIB_DIR_OPT OpenCV_LIB_DIR_DBG OpenCV_3RDPARTY_LIB_DIR_OPT OpenCV_3RDPARTY_LIB_DIR_DBG OpenCV_CONFIG_PATH)
# ======================================================
# Version variables:
# ======================================================
SET(OpenCV_VERSION @OPENCV_VERSION_PLAIN@)
SET(OpenCV_VERSION_MAJOR @OPENCV_VERSION_MAJOR@)
SET(OpenCV_VERSION_MINOR @OPENCV_VERSION_MINOR@)
SET(OpenCV_VERSION_PATCH @OPENCV_VERSION_PATCH@)
SET(OpenCV_VERSION_TWEAK 0)
SET(OpenCV_VERSION_STATUS "@OPENCV_VERSION_STATUS@")
# ====================================================================
# Link libraries: e.g. opencv_core;opencv_imgproc; etc...
# ====================================================================
SET(OpenCV_LIB_COMPONENTS @OPENCV_MODULES_CONFIGCMAKE@)
list(REMOVE_ITEM OpenCV_LIB_COMPONENTS opencv_hal)
SET(OpenCV_WORLD_COMPONENTS @OPENCV_WORLD_MODULES@)
# ==============================================================
# Extra include directories, needed by OpenCV 2 new structure
# ==============================================================
SET(OpenCV2_INCLUDE_DIRS @OpenCV2_INCLUDE_DIRS_CONFIGCMAKE@)
if(OpenCV2_INCLUDE_DIRS)
list(APPEND OpenCV_INCLUDE_DIRS ${OpenCV2_INCLUDE_DIRS})
set(OpenCV_ADD_DEBUG_RELEASE @OpenCV_ADD_DEBUG_RELEASE_CONFIGCMAKE@)
if(OpenCV_ADD_DEBUG_RELEASE)
set(OpenCV_LIB_DIR_OPT "${OpenCV_LIB_DIR_OPT}/Release")
set(OpenCV_LIB_DIR_DBG "${OpenCV_LIB_DIR_DBG}/Debug")
set(OpenCV_3RDPARTY_LIB_DIR_OPT "${OpenCV_3RDPARTY_LIB_DIR_OPT}/Release")
set(OpenCV_3RDPARTY_LIB_DIR_DBG "${OpenCV_3RDPARTY_LIB_DIR_DBG}/Debug")
endif()
endif() endif()
if(NOT CMAKE_VERSION VERSION_LESS "2.8.11") if(NOT CMAKE_VERSION VERSION_LESS "2.8.11")
@ -196,22 +106,6 @@ if(NOT CMAKE_VERSION VERSION_LESS "2.8.11")
endforeach() endforeach()
endif() endif()
# ==============================================================
# Check OpenCV availability
# ==============================================================
if(ANDROID AND OpenCV_ANDROID_NATIVE_API_LEVEL GREATER ANDROID_NATIVE_API_LEVEL)
message(FATAL_ERROR "Minimum required by OpenCV API level is android-${OpenCV_ANDROID_NATIVE_API_LEVEL}")
#always FATAL_ERROR because we can't say to the caller that OpenCV is not found
#http://www.mail-archive.com/cmake@cmake.org/msg37831.html
if(OpenCV_FIND_REQUIRED)
message(FATAL_ERROR "Minimum required by OpenCV API level is android-${OpenCV_ANDROID_NATIVE_API_LEVEL}")
elseif(NOT OpenCV_FIND_QUIETLY)
message(WARNING "Minimum required by OpenCV API level is android-${OpenCV_ANDROID_NATIVE_API_LEVEL}")
endif()
set(OpenCV_FOUND "OpenCV_FOUND-NOTFOUND")
return()#Android toolchain requires CMake > 2.6
endif()
# ============================================================== # ==============================================================
# Form list of modules (components) to find # Form list of modules (components) to find
# ============================================================== # ==============================================================
@ -223,6 +117,8 @@ if(NOT OpenCV_FIND_COMPONENTS)
endif() endif()
endif() endif()
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_ "") set(OpenCV_FIND_COMPONENTS_ "")
foreach(__cvcomponent ${OpenCV_FIND_COMPONENTS}) foreach(__cvcomponent ${OpenCV_FIND_COMPONENTS})
@ -276,89 +172,11 @@ foreach(__cvcomponent ${OpenCV_FIND_COMPONENTS})
endforeach() endforeach()
set(OpenCV_FIND_COMPONENTS ${OpenCV_FIND_COMPONENTS_}) set(OpenCV_FIND_COMPONENTS ${OpenCV_FIND_COMPONENTS_})
# ==============================================================
# Resolve dependencies
# ==============================================================
if(OpenCV_USE_MANGLED_PATHS)
set(OpenCV_LIB_SUFFIX ".${OpenCV_VERSION_MAJOR}.${OpenCV_VERSION_MINOR}.${OpenCV_VERSION_PATCH}")
else()
set(OpenCV_LIB_SUFFIX "")
endif()
foreach(__opttype OPT DBG)
SET(OpenCV_LIBS_${__opttype} "${OpenCV_LIBS}")
SET(OpenCV_EXTRA_LIBS_${__opttype} "")
# CUDA
if(OpenCV_CUDA_VERSION)
if(NOT CUDA_FOUND)
find_host_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
else()
if(NOT CUDA_VERSION_STRING VERSION_EQUAL OpenCV_CUDA_VERSION)
message(FATAL_ERROR "OpenCV static library was compiled with CUDA ${OpenCV_CUDA_VERSION} support. Please, use the same version or rebuild OpenCV with CUDA ${CUDA_VERSION_STRING}")
endif()
endif()
set(OpenCV_CUDA_LIBS_ABSPATH ${CUDA_LIBRARIES})
if(${CUDA_VERSION} VERSION_LESS "5.5")
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_npp_LIBRARY})
else()
find_cuda_helper_libs(nppc)
find_cuda_helper_libs(nppi)
find_cuda_helper_libs(npps)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nppc_LIBRARY} ${CUDA_nppi_LIBRARY} ${CUDA_npps_LIBRARY})
endif()
if(OpenCV_USE_CUBLAS)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUBLAS_LIBRARIES})
endif()
if(OpenCV_USE_CUFFT)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_CUFFT_LIBRARIES})
endif()
if(OpenCV_USE_NVCUVID)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvid_LIBRARIES})
endif()
if(WIN32)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvenc_LIBRARIES})
endif()
set(OpenCV_CUDA_LIBS_RELPATH "")
foreach(l ${OpenCV_CUDA_LIBS_ABSPATH})
get_filename_component(_tmp ${l} PATH)
if(NOT ${_tmp} MATCHES "-Wl.*")
list(APPEND OpenCV_CUDA_LIBS_RELPATH ${_tmp})
endif()
endforeach()
list(REMOVE_DUPLICATES OpenCV_CUDA_LIBS_RELPATH)
link_directories(${OpenCV_CUDA_LIBS_RELPATH})
endif()
endforeach()
# ============================================================== # ==============================================================
# Compatibility stuff # Compatibility stuff
# ============================================================== # ==============================================================
if(CMAKE_BUILD_TYPE MATCHES "Debug")
SET(OpenCV_LIB_DIR ${OpenCV_LIB_DIR_DBG} ${OpenCV_3RDPARTY_LIB_DIR_DBG})
else()
SET(OpenCV_LIB_DIR ${OpenCV_LIB_DIR_OPT} ${OpenCV_3RDPARTY_LIB_DIR_OPT})
endif()
set(OpenCV_LIBRARIES ${OpenCV_LIBS}) set(OpenCV_LIBRARIES ${OpenCV_LIBS})
if(CMAKE_CROSSCOMPILING AND OpenCV_SHARED AND (CMAKE_SYSTEM_NAME MATCHES "Linux"))
foreach(dir ${OpenCV_LIB_DIR})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath-link,${dir}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-rpath-link,${dir}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-rpath-link,${dir}")
endforeach()
endif()
# #
# Some macroses for samples # Some macroses for samples
# #
@ -376,7 +194,7 @@ endmacro()
# adds include directories in such way that directories from the OpenCV source tree go first # adds include directories in such way that directories from the OpenCV source tree go first
function(ocv_include_directories) function(ocv_include_directories)
set(__add_before "") set(__add_before "")
file(TO_CMAKE_PATH "${OpenCV_DIR}" __baseDir) file(TO_CMAKE_PATH "${OpenCV_INSTALL_PATH}" __baseDir)
foreach(dir ${ARGN}) foreach(dir ${ARGN})
get_filename_component(__abs_dir "${dir}" ABSOLUTE) get_filename_component(__abs_dir "${dir}" ABSOLUTE)
if("${__abs_dir}" MATCHES "^${__baseDir}") if("${__abs_dir}" MATCHES "^${__baseDir}")

@ -0,0 +1,50 @@
# ===================================================================================
# 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)
# include_directories(${OpenCV_INCLUDE_DIRS}) # Not needed for CMake >= 2.8.11
# target_link_libraries(MY_TARGET_NAME ${OpenCV_LIBS})
#
# Or you can search for specific OpenCV modules:
#
# find_package(OpenCV REQUIRED core videoio)
#
# If the module is found then OPENCV_<MODULE>_FOUND is set to TRUE.
#
# This file will define the following variables:
# - OpenCV_LIBS : The list of all imported targets for OpenCV modules.
# - OpenCV_INCLUDE_DIRS : The OpenCV include directories.
# - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API.
# - OpenCV_VERSION : The version of this OpenCV build: "@OPENCV_VERSION_PLAIN@"
# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION: "@OPENCV_VERSION_MAJOR@"
# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION: "@OPENCV_VERSION_MINOR@"
# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION: "@OPENCV_VERSION_PATCH@"
# - OpenCV_VERSION_STATUS : Development status of this build: "@OPENCV_VERSION_STATUS@"
#
# ===================================================================================
# 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
# for older versions of CMake to support these as well.
if(CMAKE_VERSION VERSION_LESS "2.8.3")
get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
endif()
if(NOT DEFINED OpenCV_CONFIG_SUBDIR)
set(OpenCV_CONFIG_SUBDIR "/abi-${ANDROID_NDK_ABI_NAME}")
endif()
set(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_DIR}${OpenCV_CONFIG_SUBDIR}")
if(EXISTS "${OpenCV_CONFIG_PATH}/OpenCVConfig.cmake")
include("${OpenCV_CONFIG_PATH}/OpenCVConfig.cmake")
else()
if(NOT OpenCV_FIND_QUIETLY)
message(WARNING "Found OpenCV Android Pack but it has no binaries compatible with your ABI (can't find: ${OpenCV_CONFIG_SUBDIR})")
endif()
set(OpenCV_FOUND FALSE)
endif()

@ -17,20 +17,16 @@
# #
# This file will define the following variables: # This file will define the following variables:
# - OpenCV_LIBS : The list of libraries to link against. # - OpenCV_LIBS : The list of libraries to link against.
# - OpenCV_LIB_DIR : The directory(es) where lib files are. Calling LINK_DIRECTORIES
# with this path is NOT needed.
# - OpenCV_INCLUDE_DIRS : The OpenCV include directories. # - OpenCV_INCLUDE_DIRS : The OpenCV include directories.
# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability # - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability
# - OpenCV_ANDROID_NATIVE_API_LEVEL : Minimum required level of Android API # - OpenCV_VERSION : The version of this OpenCV build: "@OPENCV_VERSION_PLAIN@"
# - OpenCV_VERSION : The version of this OpenCV build. Example: "2.4.0" # - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION: "@OPENCV_VERSION_MAJOR@"
# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "2" # - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION: "@OPENCV_VERSION_MINOR@"
# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "4" # - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION: "@OPENCV_VERSION_PATCH@"
# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "0" # - OpenCV_VERSION_STATUS : Development status of this build: "@OPENCV_VERSION_STATUS@"
# #
# Advanced variables: # Advanced variables:
# - OpenCV_SHARED # - OpenCV_SHARED
# - OpenCV_CONFIG_PATH
# - OpenCV_LIB_COMPONENTS
# #
# =================================================================================== # ===================================================================================
# #
@ -64,13 +60,11 @@ endif()
if(MSVC) if(MSVC)
if(CMAKE_CL_64) if(CMAKE_CL_64)
set(OpenCV_ARCH x64) set(OpenCV_ARCH x64)
set(OpenCV_TBB_ARCH intel64)
elseif((CMAKE_GENERATOR MATCHES "ARM") OR ("${arch_hint}" STREQUAL "ARM") OR (CMAKE_VS_EFFECTIVE_PLATFORMS MATCHES "ARM|arm")) elseif((CMAKE_GENERATOR MATCHES "ARM") OR ("${arch_hint}" STREQUAL "ARM") OR (CMAKE_VS_EFFECTIVE_PLATFORMS MATCHES "ARM|arm"))
# see Modules/CmakeGenericSystem.cmake # see Modules/CmakeGenericSystem.cmake
set(OpenCV_ARCH ARM) set(OpenCV_ARCH ARM)
else() else()
set(OpenCV_ARCH x86) set(OpenCV_ARCH x86)
set(OpenCV_TBB_ARCH ia32)
endif() endif()
if(MSVC_VERSION EQUAL 1400) if(MSVC_VERSION EQUAL 1400)
set(OpenCV_RUNTIME vc8) set(OpenCV_RUNTIME vc8)
@ -99,22 +93,13 @@ elseif(MINGW)
endif() endif()
endif() endif()
if(CMAKE_VERSION VERSION_GREATER 2.6.2)
unset(OpenCV_CONFIG_PATH CACHE)
endif()
if(NOT OpenCV_FIND_QUIETLY) if(NOT OpenCV_FIND_QUIETLY)
message(STATUS "OpenCV ARCH: ${OpenCV_ARCH}") message(STATUS "OpenCV ARCH: ${OpenCV_ARCH}")
message(STATUS "OpenCV RUNTIME: ${OpenCV_RUNTIME}") message(STATUS "OpenCV RUNTIME: ${OpenCV_RUNTIME}")
message(STATUS "OpenCV STATIC: ${OpenCV_STATIC}") message(STATUS "OpenCV STATIC: ${OpenCV_STATIC}")
endif() endif()
if(CMAKE_VERSION VERSION_LESS "2.8.12") get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH CACHE)
else()
get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY CACHE)
endif()
if(OpenCV_RUNTIME AND OpenCV_ARCH) if(OpenCV_RUNTIME AND OpenCV_ARCH)
if(OpenCV_STATIC AND EXISTS "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib/OpenCVConfig.cmake") if(OpenCV_STATIC AND EXISTS "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib/OpenCVConfig.cmake")
if(OpenCV_CUDA AND EXISTS "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib/OpenCVConfig.cmake") if(OpenCV_CUDA AND EXISTS "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}/staticlib/OpenCVConfig.cmake")
@ -132,28 +117,8 @@ if(OpenCV_RUNTIME AND OpenCV_ARCH)
endif() endif()
if(OpenCV_LIB_PATH AND EXISTS "${OpenCV_LIB_PATH}/OpenCVConfig.cmake") if(OpenCV_LIB_PATH AND EXISTS "${OpenCV_LIB_PATH}/OpenCVConfig.cmake")
set(OpenCV_LIB_DIR_OPT "${OpenCV_LIB_PATH}" CACHE PATH "Path where release OpenCV libraries are located" FORCE)
set(OpenCV_LIB_DIR_DBG "${OpenCV_LIB_PATH}" CACHE PATH "Path where debug OpenCV libraries are located" FORCE)
set(OpenCV_3RDPARTY_LIB_DIR_OPT "${OpenCV_LIB_PATH}" CACHE PATH "Path where release 3rdparty OpenCV dependencies are located" FORCE)
set(OpenCV_3RDPARTY_LIB_DIR_DBG "${OpenCV_LIB_PATH}" CACHE PATH "Path where debug 3rdparty OpenCV dependencies are located" FORCE)
include("${OpenCV_LIB_PATH}/OpenCVConfig.cmake") include("${OpenCV_LIB_PATH}/OpenCVConfig.cmake")
if(OpenCV_CUDA)
set(_OpenCV_LIBS "")
foreach(_lib ${OpenCV_LIBS})
string(REPLACE "${OpenCV_CONFIG_PATH}/gpu/${OpenCV_ARCH}/${OpenCV_RUNTIME}" "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}" _lib2 "${_lib}")
if(NOT EXISTS "${_lib}" AND EXISTS "${_lib2}")
list(APPEND _OpenCV_LIBS "${_lib2}")
else()
list(APPEND _OpenCV_LIBS "${_lib}")
endif()
endforeach()
set(OpenCV_LIBS ${_OpenCV_LIBS})
endif()
set(OpenCV_FOUND TRUE CACHE BOOL "" FORCE)
set(OPENCV_FOUND TRUE CACHE BOOL "" FORCE)
if(NOT OpenCV_FIND_QUIETLY) if(NOT OpenCV_FIND_QUIETLY)
message(STATUS "Found OpenCV ${OpenCV_VERSION} in ${OpenCV_LIB_PATH}") message(STATUS "Found OpenCV ${OpenCV_VERSION} in ${OpenCV_LIB_PATH}")
if(NOT OpenCV_LIB_PATH MATCHES "/staticlib") if(NOT OpenCV_LIB_PATH MATCHES "/staticlib")
@ -173,6 +138,5 @@ else()
You should manually point CMake variable OpenCV_DIR to your build of OpenCV library." You should manually point CMake variable OpenCV_DIR to your build of OpenCV library."
) )
endif() endif()
set(OpenCV_FOUND FALSE CACHE BOOL "" FORCE) set(OpenCV_FOUND FALSE)
set(OPENCV_FOUND FALSE CACHE BOOL "" FORCE)
endif() endif()
Loading…
Cancel
Save