I compiled OpenCV 4.6 to use it in my projects.
In my project I use a CMakeLists.txt with
find_package( OpenCV 4.6 REQUIRED )
to generate a visual studio 2019 project.
Which works. I can open, compile and link my project and run the application.
However the project links all the available 56 opencv modules to my project, even if I would only need opencv_core.
In CMake I add the libraries in this way to my project:
target_link_libraries(
${PROJECT_NAME}
PRIVATE
${OpenCV_LIBS}
...
)
where the OpenCV_LIBS
variable was assigned by the find_package call.
How can I select the actually wanted/used libs?