我在我的系统上构建了OpenCV 3,因为它不是由我的软件包管理器提供的,但是cmake仍然使用系统版本。
正如所料,当我将OpenCV_DIR
留空时,以下操作失败(因为系统OpenCV为2.4)
FIND_PACKAGE(OpenCV 3 REQUIRED)
当我export OPENCV_DIR=/home/fruitcake/Desktop/opencvsrc/installed
检查通过时,但变量的get设置为系统OpenCV目录导致编译时错误。
例如:OPENCV_CFLAGS
应设置为前缀目录。
我认为/OpenCVModules-release.cmake
中发生了一些神奇的事情,但我无法确定OPENCV_CFLAGS
是如何设置的。
拥有自定义OpenCV搜索目录OPENCV_CFLAGS
的范式方法是什么?
-- CONFIG_FILES=/home/fruitcake/Desktop/opencvsrc/installed/share/OpenCV/OpenCVModules-release.cmake
-- OPENCV_CFLAGS=-I/usr/include/opencv
-- OPENCV_INCLUDE_DIRS=/usr/include/opencv
-- OPENCV_LDFLAGS=/usr/lib64/libopencv_calib3d.so;/usr/lib64/libopencv_contrib.so;/usr/lib64/libopencv_core.so;/usr/lib64/libopencv_features2d.so;/usr/lib64/libopencv_flann.so;/usr/lib64/libopencv_gpu.so;/usr/lib64/libopencv_highgui.so;/usr/lib64/libopencv_imgproc.so;/usr/lib64/libopencv_legacy.so;/usr/lib64/libopencv_ml.so;/usr/lib64/libopencv_nonfree.so;/usr/lib64/libopencv_objdetect.so;/usr/lib64/libopencv_photo.so;/usr/lib64/libopencv_stitching.so;/usr/lib64/libopencv_superres.so;/usr/lib64/libopencv_ts.a;/usr/lib64/libopencv_video.so;/usr/lib64/libopencv_videostab.so;/usr/lib64/libXext.so;/usr/lib64/libX11.so;/usr/lib64/libICE.so;/usr/lib64/libSM.so;/usr/lib64/libGL.so;/usr/lib64/libGLU.so;-lrt;-lpthread;-lm;-ldl
-- OPENCV_LDFLAGS_OTHER=/usr/lib64/libopencv_calib3d.so;/usr/lib64/libopencv_contrib.so;/usr/lib64/libopencv_core.so;/usr/lib64/libopencv_features2d.so;/usr/lib64/libopencv_flann.so;/usr/lib64/libopencv_gpu.so;/usr/lib64/libopenc _highgui.so;/usr/lib64/libopencv_imgproc.so;/usr/lib64/libopencv_legacy.so;/usr/lib64/libopencv_ml.so;/usr/lib64/libopencv_nonfree.so;/usr/lib64/libopencv_objdetect.so;/usr/lib64/libopencv_photo.so;/usr/lib64/libopencv_stitching.so;/usr/lib64/libopencv_superres.so;/usr/lib64/libopencv_ts.a;/usr/lib64/libopencv_video.so;/usr/lib64/libopencv_videostab.so;/usr/lib64/libXext.so;/usr/lib64/libX11.so;/usr/lib64/libICE.so;/usr/lib64/libSM.so;/usr/lib64/libGL.so;/usr/lib64/libGLU.so
-- OPENCV_STATIC_CFLAGS=-I/usr/include/opencv
-- OPENCV_STATIC_INCLUDE_DIRS=/usr/include/opencv
-- OPENCV_STATIC_LDFLAGS=/usr/lib64/libopencv_calib3d.so;/usr/lib64/libopencv_contrib.so;/usr/lib64/libopencv_core.so;/usr/lib64/libopencv_features2d.so;/usr/lib64/libopencv_flann.so;/usr/lib64/libopencv_gpu.so;/usr/lib64/libopencv_highgui.so;/usr/lib64/libopencv_imgproc.so;/usr/lib64/libopencv_legacy.so;/usr/lib64/libopencv_ml.so;/usr/lib64/libopencv_nonfree.so;/usr/lib64/libopencv_objdetect.so;/usr/lib64/libopencv_photo.so;/usr/lib64/libopencv_stitching.so;/usr/lib64/libopencv_superres.so;/usr/lib64/libopencv_ts.a;/usr/lib64/libopencv_video.so;/usr/lib64/libopencv_videostab.so;/usr/lib64/libXext.so;/usr/lib64/libX11.so;/usr/lib64/libICE.so;/usr/lib64/libSM.so;/usr/lib64/libGL.so;/usr/lib64/libGLU.so;-lrt;-lpthread;-lm;-ldl
-- OPENCV_STATIC_LDFLAGS_OTHER=/usr/lib64/libopencv_calib3d.so;/usr/lib64/libopencv_contrib.so;/usr/lib64/libopencv_core.so;/usr/lib64/libopencv_features2d.so;/usr/lib64/libopencv_flann.so;/usr/lib64/libopencv_gpu.so;/usr/lib64/libopencv_highgui.so;/usr/lib64/libopencv_imgproc.so;/usr/lib64/libopencv_legacy.so;/usr/lib64/libopencv_ml.so;/usr/lib64/libopencv_nonfree.so;/usr/lib64/libopencv_objdetect.so;/usr/lib64/libopencv_photo.so;/usr/lib64/libopencv_stitching.so;/usr/lib64/libopencv_superres.so;/usr/lib64/libopencv_ts.a;/usr/lib64/libopencv_video.so;/usr/lib64/libopencv_videostab.so;/usr/lib64/libXext.so;/usr/lib64/libX11.so;/usr/lib64/libICE.so;/usr/lib64/libSM.so;/usr/lib64/libGL.so;/usr/lib64/libGLU.so
-- OPENCV_opencv_INCLUDEDIR=
-- OPENCV_opencv_LIBDIR=
-- OPENCV_opencv_PREFIX=
-- OPENCV_opencv_VERSION=
-- OpenCV_CONFIG=/home/fruitcake/Desktop/opencvsrc/installed/share/OpenCV/OpenCVConfig.cmake
-- OpenCV_CONSIDERED_CONFIGS=/home/fruitcake/Desktop/opencvsrc/installed/share/OpenCV/OpenCVConfig.cmake
-- OpenCV_DIR=/home/fruitcake/Desktop/opencvsrc/installed/share/OpenCV
-- OpenCV_FIND_COMPONENTS_=opencv_videostab;opencv_videoio;opencv_video;opencv_ts;opencv_superres;opencv_stitching;opencv_shape;opencv_photo;opencv_objdetect;opencv_ml;opencv_imgproc;opencv_imgcodecs;opencv_highgui;opencv_flann;opencv_features2d;opencv_cudev;opencv_cudawarping;opencv_cudastereo;opencv_cudaoptflow;opencv_cudalegacy;opencv_cudaimgproc;opencv_cudafilters;opencv_cudafeatures2d;opencv_cudacodec;opencv_cudabgsegm;opencv_cudaarithm;opencv_cuda;opencv_core;opencv_calib3d
-- OpenCV_INCLUDE_DIRS=/usr/include/opencv;/usr/include
-- OpenCV_LIBRARIES=opencv_videostab;opencv_videoio;opencv_video;opencv_ts;opencv_superres;opencv_stitching;opencv_shape;opencv_photo;opencv_objdetect;opencv_ml;opencv_imgproc;opencv_imgcodecs;opencv_highgui;opencv_flann;opencv_features2d;opencv_cudev;opencv_cudawarping;opencv_cudastereo;opencv_cudaoptflow;opencv_cudalegacy;opencv_cudaimgproc;opencv_cudafilters;opencv_cudafeatures2d;opencv_cudacodec;opencv_cudabgsegm;opencv_cudaarithm;opencv_cuda;opencv_core;opencv_calib3d
-- OpenCV_LIBS=opencv_videostab;opencv_videoio;opencv_video;opencv_ts;opencv_superres;opencv_stitching;opencv_shape;opencv_photo;opencv_objdetect;opencv_ml;opencv_imgproc;opencv_imgcodecs;opencv_highgui;opencv_flann;opencv_features2d;opencv_cudev;opencv_cudawarping;opencv_cudastereo;opencv_cudaoptflow;opencv_cudalegacy;opencv_cudaimgproc;opencv_cudafilters;opencv_cudafeatures2d;opencv_cudacodec;opencv_cudabgsegm;opencv_cudaarithm;opencv_cuda;opencv_core;opencv_calib3d
-- OpenCV_LIBS_DBG=opencv_videostab;opencv_videoio;opencv_video;opencv_ts;opencv_superres;opencv_stitching;opencv_shape;opencv_photo;opencv_objdetect;opencv_ml;opencv_imgproc;opencv_imgcodecs;opencv_highgui;opencv_flann;opencv_features2d;opencv_cudev;opencv_cudawarping;opencv_cudastereo;opencv_cudaoptflow;opencv_cudalegacy;opencv_cudaimgproc;opencv_cudafilters;opencv_cudafeatures2d;opencv_cudacodec;opencv_cudabgsegm;opencv_cudaarithm;opencv_cuda;opencv_core;opencv_calib3d
-- OpenCV_LIBS_OPT=opencv_videostab;opencv_videoio;opencv_video;opencv_ts;opencv_superres;opencv_stitching;opencv_shape;opencv_photo;opencv_objdetect;opencv_ml;opencv_imgproc;opencv_imgcodecs;opencv_highgui;opencv_flann;opencv_features2d;opencv_cudev;opencv_cudawarping;opencv_cudastereo;opencv_cudaoptflow;opencv_cudalegacy;opencv_cudaimgproc;opencv_cudafilters;opencv_cudafeatures2d;opencv_cudacodec;opencv_cudabgsegm;opencv_cudaarithm;opencv_cuda;opencv_core;opencv_calib3d
-- OpenCV_LIB_COMPONENTS=opencv_videostab;opencv_videoio;opencv_video;opencv_ts;opencv_superres;opencv_stitching;opencv_shape;opencv_photo;opencv_objdetect;opencv_ml;opencv_imgproc;opencv_imgcodecs;opencv_highgui;opencv_flann;opencv_features2d;opencv_cudev;opencv_cudawarping;opencv_cudastereo;opencv_cudaoptflow;opencv_cudalegacy;opencv_cudaimgproc;opencv_cudafilters;opencv_cudafeatures2d;opencv_cudacodec;opencv_cudabgsegm;opencv_cudaarithm;opencv_cuda;opencv_core;opencv_calib3d
-- _DIR=/home/fruitcake/Desktop/opencvsrc/installed/share/OpenCV
-- OPENCV_DIR: /usr/include/opencv
我正在使用cmake版本3.1.0
答案 0 :(得分:1)
我不得不删除CMakeCache.txt