I have two Opencvs, opencv-2.4.10 is installed in / usr, and opencv-3.1 is installed in / usr / local. I can easily set the opencv path in Eclipse. In cmake, how can I set the path for one of the opencv that I would like to use for this project? Thanks
This question is a duplicate. How do I get the C ++ compiler to use one of the different versions of installed packages using CMake? , but it was found by search engines, so I am adding a response from texasflood , which, it seemed to me, works with CMake 2.8.12.2 and OpenCV 3.2.0 on Ubuntu 12.4:
find_package:
find_package
find_package(OpenCV REQUIRED PATHS "/usr/opencv-2.4.10")
Linux , Windows 10 64bit.
CmakeLists.txt , OpenCV_DIR, CMake.
CmakeLists.txt
OpenCV_DIR
, OpenCV C:/opencv,
C:/opencv
SET("OpenCV_DIR" "C:/opencv")
CmakeLists.txt.
-
SET("OpenCV_DIR" "/usr/opencv-2.4.10")
, , Linux.