How to solve:-1: error: No rule to make target `/home/xxxxx/opencv-3.0.0/lib/libopencv_xphoto.so.3.0.0', needed by `xxxxx'. Stop

How to solve:-1: error: No rule to make target `/home/xxxxx/opencv-3.0.0/lib/libopencv_xphoto.so.3.0.0', needed by `xxxxx'. Stop

我正在尝试使用 cmake 编译带有 OpenCV 3.0 的代码。我试图让它尽可能简单:

project(xxxxx)
cmake_minimum_required(VERSION 2.8)
aux_source_directory(. SRC_LIST)
find_package(OpenCV)
message("Libs: ${OpenCV_LIBS}")
message("Include Dir: ${OpenCV_INCLUDE_DIRS}")
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(${PROJECT_NAME}
${OpenCV_LIBS}
)

我的 main.cpp 中只有:

#include <opencv2/core.hpp>

cv::UMat trqw;

我收到 "No rule to make target" 错误。该错误表明它正在查找不存在的 "opencv-3.0.0/lib/" 文件夹,它应该在 "opencv-3.0.0/build/lib/" 中查找。我在构建 OpenCV 时是否做错了什么,导致 CMAKE 包在错误的位置查找,如果没有,是否有更好的方法让我的 CMakeLists.txt 指示它在正确的文件夹中查找?我在 target_link_libraries 调用中尝试了“${OPENCL_LIBRARIES}”,但没有任何变化。

谢谢!

----编辑----------------

是的,我的 cmakelists.txt 中也有 find_package(OpenCV),谢谢!我也试过 find_package(OpenCV 3.0) 和 find_package(OpenCV 3.0 REQUIRED) 但无济于事。

------------编辑--------------

的输出
message("Libs: ${OpenCV_LIBS}") # I added it to the orig question

库:opencv_xphoto;opencv_xobjdetect;opencv_ximgproc;opencv_xfeatures2d;opencv_tracking;opencv_text;opencv_surface_matching;opencv_stereo;opencv_saliency;opencv_rgbd;opencv_reg;opencv_optflow;opencv_line_descriptor;opencv_face;opencv_dpm;opencv_datasets;opencv_ccalib;opencv_bioinspired;opencv_bgsegm;opencv_aruco;opencv_adas;opencv_world;opencv_videostab;opencv_videoio ;opencv_video;opencv_superres;opencv_stitching;opencv_shape;opencv_photo;opencv_objdetect;opencv_ml;opencv_imgproc;opencv_imgcodecs;opencv_highgui;opencv_hal;opencv_flann;opencv_features2d;opencv_core;opencv_calib3d

包括目录:

/home/xxxxx/opencv-3.0.0/build;/home/xxxxx/opencv-3.0.0/include;/home/xxxxx/opencv-3.0.0/include/opencv;/home/xxxxx/opencv-3.0.0/modules/hal/include;/home/xxxxx/opencv-3.0.0/modules/core/include;/home/xxxxx/opencv-3.0.0/modules/flann/include;/home/xxxxx/opencv-3.0.0/modules/imgproc/include;/home/xxxxx/opencv-3 .0.0/modules/ml/include;/home/xxxxx/opencv-3.0.0/modules/photo/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/reg/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/surface_matching/include ;/home/xxxxx/opencv-3.0.0/modules/video/include;/home/xxxxx/opencv-3.0.0/modules/imgcodecs/include;/home/xxxxx/opencv-3.0.0/modules/shape/include;/home/xxxxx/opencv-3.0.0 /modules/videoio/include;/home/xxxxx/opencv-3.0.0/modules/highgui/include;/home/xxxxx/opencv-3.0.0/modules/objdetect/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/optflow/include;/home/xxxxx/opencv-3.0.0/modules/superres/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/tracking/include;/home/xxxxx/opencv-3.0.0/modules/ts/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/xobjdetect/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/xphoto/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/adas/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/bgsegm/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/bioinspired/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/dpm/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/face/include;/home/xxxxx/opencv-3.0.0/modules/features2d/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/line_descriptor/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/saliency/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/text/include;/home/xxxxx/opencv-3 .0.0/modules/calib3d/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/ccalib/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/datasets/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/rgbd/include ;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/stereo/include;/home/xxxxx/opencv-3.0.0/modules/stitching/include;/home/xxxxx/opencv-3.0.0/modules/videostab/include;/home/xxxxx/opencv-3.0.0 /modules/world/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/xfeatures2d/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/ximgproc/include;/home/xxxxx/opencv-3.0.0/opencv_contrib-master/modules/aruco/include

感谢 Tsyvarez 的所有帮助!

set ( OpenCV_DIR   "/home/xxxxx/opencv-3.0.0/build/")

之前

find_package( OpenCV 3.0 REQUIRED)

在cmakelists.txt

谢谢!