I am trying to create a project that is dependent on OpenCV. I installed Opencv using macports, and when I try to build a project, cmake gives the following result:
CMake Error at CMakeLists.txt:47 (FIND_PACKAGE): By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "OpenCV", but CMake did not find one. 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.
I searched a bit for this problem and added the following env. variables in my $HOME/.profile file
export DYLD_LIBRARY_PATH=/opt/local/lib:$DYLD_LIBRARY_PATH export CMAKE_PREFIX_PATH=/opt/local
without success. I checked and all opencv files are listed in the / opt / local / lib and / opt / local / include / opencv directories. There is also OpenCVConfig.cmake along the following path:
/opt/local/lib/cmake/OpenCVConfig.cmake
How to make cmake find out the path where opencv is installed? Previously, I myself created OpenCV using cmake, and installed it in / usr / local, and then worked fine without any other fixes. However, I had some problems with ffmpeg, and now I'm switching to using macports.
source share