Using opencv without installing it by using add_subdirectory of cmake


Is there a way instead of installing opencv to use it with add_subdirectory of cmake when we have already a project handled with cmake.

Not that I know of.

Is there a reason you can’t just pass -DOpenCV_DIR=OPENCV_BUILD_DIR to CMake and use find_package(OpenCV) instead of add_subdirectory()?

1 Like

Thank you for answering me
Yes for the moment I use an installed version.
My idea was to use add_subdirectory in order to easily change some compilation options