ubuntu - 尝试在 Ubuntu 上构建 OpenCV 3 世界模块时出现 CMake 不存在目标错误

标签 ubuntu build cmake opencv3.0

我目前正在尝试在 Ubuntu 上构建 OpenCV 3。如果我只是使用默认设置运行 CMake,一切正常(配置 + 生成)并且生成的 makefile 也可以毫无问题地编译。但是,我还想构建 opencv_world 模块。因此我在 CMake ( BUILD_opencv_world ) 中启用了相应的选项。不幸的是,这样我得到了很多错误,比如 get_target_property() called with non-existent target "opencv_shape". ... CMakeLists.txt:765 (ocv_get_all_libs)当我点击配置按钮时:

...
Processing WORLD modules...
    module opencv_hal...
    module opencv_core...
    module opencv_flann...
    module opencv_imgproc...
    module opencv_ml...
    module opencv_photo...
    module opencv_video...
    module opencv_imgcodecs...
    module opencv_shape...
    module opencv_videoio...
  videoio: Removing WinRT API headers by default
    module opencv_highgui...
    module opencv_objdetect...
    module opencv_superres...
    module opencv_features2d...
    module opencv_calib3d...
    module opencv_stitching...
    module opencv_videostab...
Processing WORLD modules... DONE
Processing module opencv_ts...
CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_calib3d".
Call Stack (most recent call first):
  cmake/OpenCVGenPkgconfig.cmake:38 (ocv_get_all_libs)
  CMakeLists.txt:648 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_core".
Call Stack (most recent call first):
  cmake/OpenCVGenPkgconfig.cmake:38 (ocv_get_all_libs)
  CMakeLists.txt:648 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_features2d".
Call Stack (most recent call first):
  cmake/OpenCVGenPkgconfig.cmake:38 (ocv_get_all_libs)
  CMakeLists.txt:648 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_flann".
Call Stack (most recent call first):
  cmake/OpenCVGenPkgconfig.cmake:38 (ocv_get_all_libs)
  CMakeLists.txt:648 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_hal".
Call Stack (most recent call first):
  cmake/OpenCVGenPkgconfig.cmake:38 (ocv_get_all_libs)
  CMakeLists.txt:648 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_highgui".
Call Stack (most recent call first):
  cmake/OpenCVGenPkgconfig.cmake:38 (ocv_get_all_libs)
  CMakeLists.txt:648 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_imgcodecs".
Call Stack (most recent call first):
  cmake/OpenCVGenPkgconfig.cmake:38 (ocv_get_all_libs)
  CMakeLists.txt:648 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_imgproc".
Call Stack (most recent call first):
  cmake/OpenCVGenPkgconfig.cmake:38 (ocv_get_all_libs)
  CMakeLists.txt:648 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_ml".
Call Stack (most recent call first):
  cmake/OpenCVGenPkgconfig.cmake:38 (ocv_get_all_libs)
  CMakeLists.txt:648 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_objdetect".
Call Stack (most recent call first):
  cmake/OpenCVGenPkgconfig.cmake:38 (ocv_get_all_libs)
  CMakeLists.txt:648 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_photo".
Call Stack (most recent call first):
  cmake/OpenCVGenPkgconfig.cmake:38 (ocv_get_all_libs)
  CMakeLists.txt:648 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_shape".
Call Stack (most recent call first):
  cmake/OpenCVGenPkgconfig.cmake:38 (ocv_get_all_libs)
  CMakeLists.txt:648 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_stitching".
Call Stack (most recent call first):
  cmake/OpenCVGenPkgconfig.cmake:38 (ocv_get_all_libs)
  CMakeLists.txt:648 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_superres".
Call Stack (most recent call first):
  cmake/OpenCVGenPkgconfig.cmake:38 (ocv_get_all_libs)
  CMakeLists.txt:648 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_video".
Call Stack (most recent call first):
  cmake/OpenCVGenPkgconfig.cmake:38 (ocv_get_all_libs)
  CMakeLists.txt:648 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_videoio".
Call Stack (most recent call first):
  cmake/OpenCVGenPkgconfig.cmake:38 (ocv_get_all_libs)
  CMakeLists.txt:648 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_videostab".
Call Stack (most recent call first):
  cmake/OpenCVGenPkgconfig.cmake:38 (ocv_get_all_libs)
  CMakeLists.txt:648 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.


General configuration for OpenCV 3.0.0 =====================================
  Version control:               unknown

  Platform:
    Host:                        Linux 3.19.0-15-generic x86_64
    CMake:                       3.0.2
    CMake generator:             Unix Makefiles
    CMake build tool:            /usr/bin/make
    Configuration:               Release

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                /usr/bin/c++  (ver 4.9.2)
    C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
    C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
    C Compiler:                  /usr/bin/cc
    C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
    C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
    Linker flags (Release):      
    Linker flags (Debug):        
    Precompiled headers:         YES
CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_calib3d".
Call Stack (most recent call first):
  CMakeLists.txt:765 (ocv_get_all_libs)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_core".
Call Stack (most recent call first):
  CMakeLists.txt:765 (ocv_get_all_libs)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_features2d".
Call Stack (most recent call first):
  CMakeLists.txt:765 (ocv_get_all_libs)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_flann".
Call Stack (most recent call first):
  CMakeLists.txt:765 (ocv_get_all_libs)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_hal".
Call Stack (most recent call first):
  CMakeLists.txt:765 (ocv_get_all_libs)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_highgui".
Call Stack (most recent call first):
  CMakeLists.txt:765 (ocv_get_all_libs)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_imgcodecs".
Call Stack (most recent call first):
  CMakeLists.txt:765 (ocv_get_all_libs)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_imgproc".
Call Stack (most recent call first):
  CMakeLists.txt:765 (ocv_get_all_libs)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_ml".
Call Stack (most recent call first):
  CMakeLists.txt:765 (ocv_get_all_libs)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_objdetect".
Call Stack (most recent call first):
  CMakeLists.txt:765 (ocv_get_all_libs)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_photo".
Call Stack (most recent call first):
  CMakeLists.txt:765 (ocv_get_all_libs)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_shape".
Call Stack (most recent call first):
  CMakeLists.txt:765 (ocv_get_all_libs)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_stitching".
Call Stack (most recent call first):
  CMakeLists.txt:765 (ocv_get_all_libs)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_superres".
Call Stack (most recent call first):
  CMakeLists.txt:765 (ocv_get_all_libs)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_video".
Call Stack (most recent call first):
  CMakeLists.txt:765 (ocv_get_all_libs)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_videoio".
Call Stack (most recent call first):
  CMakeLists.txt:765 (ocv_get_all_libs)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/OpenCVUtils.cmake:798 (get_target_property):
  Policy CMP0045 is not set: Error on non-existent target in
  get_target_property.  Run "cmake --help-policy CMP0045" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  get_target_property() called with non-existent target "opencv_videostab".
Call Stack (most recent call first):
  CMakeLists.txt:765 (ocv_get_all_libs)
This warning is for project developers.  Use -Wno-dev to suppress it.

    Extra dependencies:          dl m pthread rt
    3rdparty dependencies:       zlib libjpeg libwebp libpng libtiff libjasper IlmImf ippicv

  OpenCV modules:
    To be built:                 hal core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres ts features2d calib3d stitching videostab world
    Disabled:                    -
    Disabled by dependency:      -
    Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 viz
...

有没有人知道这里可能是什么问题?

最佳答案

不确定这是否是您的问题的原因,但我遇到了类似的错误,而我的原因是 CMake 配置文件中的目标名称与系统中已安装依赖项的名称不同 .
我可以通过查看在 /usr/lib/x86_64-linux-gnu/cmake/<that target's name> 中声明目标的依赖项的“目标导入文件”来检查这一点。 ,并将其与依赖项目的 CMake 配置文件进行比较。

关于ubuntu - 尝试在 Ubuntu 上构建 OpenCV 3 世界模块时出现 CMake 不存在目标错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31346696/

相关文章:

makefile - 高工作值(value)的缺点

ubuntu - 在 Ubuntu 上使用 Perforce 命令行创建客户端工作区

linux - ubuntu 服务器上的参数太多

c++ - KDevelop4 : target build directory doubled after importing CMakeList. 文本文件

java - 如何在 gradle 构建中有许多任务配置?

c++ - 如何在 Windows XP 上为 Qt 4.7 正确构建 OpenCV 2.3.1?

c++ - OpenCV cmake 构建总是在 Windows 中抛出错误

php - Zend Framework、phpUnit 和 Doctrine 导致问题

ubuntu - Apticron 不发送电子邮件

visual-studio-2008 - 退出 Debug模式后,如何防止 Visual Studio 编译解决方案?