Reputation: 575
I am trying to use cmake to compile code with OpenCV 3.0 in it. I tried to make it as simple as possible:
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}
)
all I have in my main.cpp is:
#include <opencv2/core.hpp>
and
cv::UMat trqw;
I get the "No rule to make target" error. The error suggests that it is looking in the "opencv-3.0.0/lib/" folder which doesn't exist, it should be looking in the "opencv-3.0.0/build/lib/". Did I do something wrong when I built OpenCV that the CMAKE package looks in the wrong spot, and if not is there a better way for my CMakeLists.txt to direct it to look in the correct folder? I tried "${OPENCL_LIBRARIES}" in the target_link_libraries call and no change.
Thanks!
----edit----------------
yes, I did have find_package(OpenCV) in my cmakelists.txt as well, thanks! I've also tried find_package(OpenCV 3.0) and find_package(OpenCV 3.0 REQUIRED) with no avail.
----------edit--------------- output of
message("Libs: ${OpenCV_LIBS}") # I added it to the orig question
Libs: 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
Include Dir:
/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
Upvotes: 1
Views: 6810
Reputation: 575
Thanks to Tsyvarez for all the help!
set ( OpenCV_DIR "/home/xxxxx/opencv-3.0.0/build/")
before
find_package( OpenCV 3.0 REQUIRED)
in cmakelists.txt
Thanks!
Upvotes: 1