ROS "catkin_make" 找不到 OpenCVConfig.cmake

ROS "catkin_make" cannot find OpenCVConfig.cmake

我正在尝试使用 "catkin_make" 命令构建一个需要 OpenCV 的 ROS 包。

尝试构建时,CMakeList 命令出现以下错误 "find_package(OpenCV REQUIRED)":

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.

我在 /usr/share/OpenCV/ 找到了 "OpenCVConfig.cmake" 文件,并在 "OpenCV_DIR" 环境变量中设置了这个位置。 尽管如此,我仍然收到上面列出的错误。

有什么想法吗?

知道我正在尝试 link OpenCV4Tegra 和 Jetson TX1 上的软件包可能会有用

通过在我的 cmakelists 文件中的 find_package() 命令之前添加行 set(OpenCV_DIR /usr/share/OpenCV/) 解决了这个问题。