我目前遇到find_package(opencv)
的问题,它给出了错误消息:
-- Could not find the required component 'OpenCV'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
所以..是的,一个解决方案会添加prefix_path,但是如何让它与find_package()
一起工作而不明确说明它必须寻找的路径..为什么它不能在第一个找到它地方,这样做的问题是CMakelist在一个人群中共享,其中我是唯一一个有这个问题的人,尽管.cmake文件位于同一个位置..
我在ubuntu机器上运行它。
OpenCV v2.4.8
.cmake文件位于
/usr/local/share/OpenCV/OpenCVConfig.cmake /usr/share/OpenCV/OpenCVConfig.cmake
opencv安装为sudo apt-get install libopencv-dev