GetOpenCV module
set(BUILD_STATIC_LIBS ON)
set(BUILD_SHARED_LIBS OFF)
message(STATUS "Downloading and extracting OpenCV library sources. This will take some time...")
include(FetchContent)
Set(FETCHCONTENT_QUIET FALSE) # Needed to print downloading progress
FetchContent_Declare(
opencv
URL https://github.com/opencv/opencv/archive/refs/tags/4.11.0.zip # downloading a zip release speeds up the download
USES_TERMINAL_DOWNLOAD TRUE
GIT_PROGRESS TRUE
DOWNLOAD_EXTRACT_TIMESTAMP FALSE
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(opencv)
CMakeLists.txt
add_executable(Pixer main.cpp)
target_link_libraries(Pixer ${OpenCV_LIBS})
target_include_directories(Pixer PRIVATE ${OpenCV_INCLUDE_DIRS})
build error
ninja: error: '_deps/opencv-build/lib/libopencv_calib3d4110d.a', needed by 'Pixer.exe', missing and no known rule to make it
Enivronment
Windows 11, msys2 mingw gcc toolchain