使用Cmake为C ++项目设置Opencv路径 [英] Set Opencv path for a c++ project using Cmake

查看:528
本文介绍了使用Cmake为C ++项目设置Opencv路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个Opencv,在/usr中安装了opencv-2.4.10,在/usr/local中安装了opencv-3.1.我可以在Eclipse中轻松设置opencv路径.在cmake中,如何设置我想用于该项目的opencv之一的路径? 谢谢

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 for one of the opencvs I like to use for that project? Thanks

推荐答案

此问题与来自texasflood的答案:

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:

只需更改find_package命令:

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

这篇关于使用Cmake为C ++项目设置Opencv路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆