Skip to content

Can't make find_package(Opencv) on opencv 3.3rc for android: #9155

@uelordi01

Description

@uelordi01
System information (version)
  • OpenCV => 3.3rc
  • Operating System / Platform => Android
  • Compiler => Clang
Detailed description

Hi:

I am trying to integrate the new Opencv3.3rc tag to use OpenCV dnn module.
https://github.com/opencv/opencv/tree/3.3.0-rc

I can cross compile the OpenCV library but when I try to make the FindOpencv required I have this error:

Some (but not all) targets in this export set where already defined.

The unique target registered is *cpufeatures* as you can see:

      Targets Defined: cpufeatures
      Targets not yet defined:
      libtiff;libjpeg;libwebp;libjasper;libpng;IlmImf;tegra_hal;libprotobuf;opencv_core;opencv_flann;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_video;opencv_dnn;opencv_imgcodecs;opencv_shape;opencv_videoio;opencv_highgui;opencv_superres;opencv_features2d;opencv_calib3d;opencv_java;opencv_stitching;opencv_videostab

As I can see in the OpenCVconfig.cmake configuration file, currently, there are two methods to find OpenCV:

this:

find_package(OpenCV REQUIRED)

or defining modules:

find_package(OpenCV REQUIRED core videoio)

But none of them works.

The error comes from this snippet OpenCVModules.cmake

# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

# Protect against multiple inclusion, which would fail when already imported targets are added once more.
set(_targetsDefined)
set(_targetsNotDefined)
set(_expectedTargets)
foreach(_expectedTarget cpufeatures libtiff libjpeg libwebp libjasper libpng IlmImf tegra_hal libprotobuf opencv_core opencv_flann opencv_imgproc opencv_ml opencv_objdetect opencv_photo opencv_video opencv_dnn opencv_imgcodecs opencv_shape opencv_videoio opencv_highgui opencv_superres opencv_features2d opencv_calib3d opencv_java opencv_stitching opencv_videostab)
  list(APPEND _expectedTargets ${_expectedTarget})
  if(NOT TARGET ${_expectedTarget})
    list(APPEND _targetsNotDefined ${_expectedTarget})
  endif()
  if(TARGET ${_expectedTarget})
    list(APPEND _targetsDefined ${_expectedTarget})
  endif()
endforeach()
if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
  unset(_targetsDefined)
  unset(_targetsNotDefined)
  unset(_expectedTargets)
  set(CMAKE_IMPORT_FILE_VERSION)
  cmake_policy(POP)
  return()
endif()
if(NOT "${_targetsDefined}" STREQUAL "")
  message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
endif()
Steps to reproduce

find_package(OpenCV REQUIRED)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions