Could not find a package configuration file – OpenCVConfig.cmake

I am playing nowadays with OpenCV for visual computing using C++ on Mac OS platform.I installed openCV and by default, it get installed in “/opt/local“. I wrote a test program in c++ using opencv library and tried to build it using cmake. But, I found following errors while running cmake.

CMake Error at CMakeLists.txt:3 (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:
  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
-- Configuring incomplete, errors occurred!
  This means that you have to provide opencv directory information so that the opencv libs get available during making of the opencv project.
  Here are the solution:
  Quick solution: “Export the OpenCV_DIR into the current terminal”
   export OpenCV_DIR=/opt/local/lib/cmake/
   If it works then,Permanent Solution: “Save it into .profile of MacOS”

  $ vim ~/.profile

And it will there as far as your MacOS survives. 😉

Social Media Icons Powered by Acurax Web Design Company