Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake: How to only include part of OpenCV?

Tags:

c++

opencv

cmake

When I use CMake with FIND_PACKAGE( OpenCV REQUIRED ), all components of OpenCV get included and all libs linked, and all paths show up in include dirs in VS. However, since OpenCV 2, every part of the lib can be included and linked to on its own. So if my project only uses the "core" and "imgproc" part of OpenCV, I dont want to bloat my project (and project files) by linking to all of OpenCV. Is it possible to only include part of it in CMake?

like image 708
Ela782 Avatar asked Jun 25 '12 20:06

Ela782


1 Answers

Since OpenCV 2.4.0 it is as simple as:

 FIND_PACKAGE( OpenCV REQUIRED core imgproc)
like image 121
Andrey Kamaev Avatar answered Sep 28 '22 18:09

Andrey Kamaev