Set Opencv path for a c++ project using Cmake

后端 未结 3 1272
没有蜡笔的小新
没有蜡笔的小新 2021-02-15 17:24

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

3条回答
  •  庸人自扰
    2021-02-15 18:21

    This question is a duplicate of How to force c++ compiler use one of different installed package's versions, using CMake? but it is found by search engines so I add the answer from texasflood that I found to be working with CMake 2.8.12.2 and OpenCV 3.2.0 on Ubuntu 12.4:

    Simply change the find_package command:

    find_package(OpenCV REQUIRED PATHS "/usr/opencv-2.4.10")
    

提交回复
热议问题