I have two Opencvs, opencv-2.4.10 is installed in /usr and opencv-3.1 is installed in /usr/local. I can set the opencv path in Eclipse easily. In cmake, how can I set the path f
None of the other answers worked for me (linux, opencv 4.0.0, haven't tested yet with opencv 3.x.x).
Adding the following before the line find_package(...)
in the CMakeLists.txt worked:
set(OpenCV_DIR /path/to/opencv_install_dir/lib/cmake/opencv4)
If opencv was compiled from source with a none standard installation target directory, then /path/to/opencv_install_dir
is (should be) known, otherwise search for the location of the directory structure lib/cmake/opencv*
.