CMake: How to enable only part of OpenCV?

When I use CMake with FIND_PACKAGE( OpenCV REQUIRED ) , all OpenCV components are included in the package and all associated libs, and all paths are displayed in include dirs in VS. However, since OpenCV 2, each part of lib can be included and bound by itself. Therefore, if my project uses only the "core" and "imgproc" parts of OpenCV, I don’t want to inflate my project (and the project files) by contacting all of OpenCV. Is it possible to include only part of it in CMake?

+4
source share
1 answer

Since OpenCV 2.4.0 is as simple as:

  FIND_PACKAGE( OpenCV REQUIRED core imgproc) 
+5
source

All Articles