Issue
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()
Anybody knows how this could happen?
Solution
I found the answer:
I was defining the cpu-features library before, so this code was the conflicting part in the CMakelists.txt.
add_library(cpufeatures STATIC
${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
Removing this part, the problem was solved.
Answered By - uelordi
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.