Search code examples
c++opencvcmakeroscatkin

ROS "catkin_make" cannot find OpenCVConfig.cmake


I'm trying to build a ROS package which requires OpenCV using the "catkin_make" command.

Upon trying to build, I get the following error for CMakeList command "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.

I found the "OpenCVConfig.cmake" file at /usr/share/OpenCV/ and have set this location within the "OpenCV_DIR" env variable. Despite this, I still get the error listed above.

Any ideas?

It might be useful to know that I'm trying to link OpenCV4Tegra with the package on a Jetson TX1


Solution

  • Fixed the problem by adding the line set(OpenCV_DIR /usr/share/OpenCV/) before the find_package() command in my cmakelists file.