OpenCV

hunter_add_package(OpenCV)
find_package(OpenCV REQUIRED)

add_executable(foo foo.cpp)
target_link_libraries(foo PRIVATE ${OpenCV_LIBS})

Qt back-end

Qt back-end support for desktop can be enabled by creating a custom config with:

hunter_config(
    OpenCV
    VERSION ${HUNTER_OpenCV_VERSION}
    CMAKE_ARGS WITH_QT=YES
)

FFmpeg support

hunter_config(
    OpenCV
    VERSION ${HUNTER_OpenCV_VERSION}
    CMAKE_ARGS
    WITH_FFMPEG=ON
    OPENCV_FFMPEG_USE_FIND_PACKAGE=YES
)

Known issues

  • since hunter v0.18.44 OpenCV can’t find system libraries to link against on Linux. If you need those dependencies (FFMPEG, GTK, GStreamer, V4L2, etc.) you need to fork hunter and revert commit f6f0965 in your fork. Try this fork for some already patched releases.