Skip to content

Instantly share code, notes, and snippets.

@optimalistel
Created May 21, 2015 15:36
Show Gist options
  • Save optimalistel/f4de869ec59764bd65be to your computer and use it in GitHub Desktop.
Save optimalistel/f4de869ec59764bd65be to your computer and use it in GitHub Desktop.
CMake Include OpenCV - Win32
#--------------------------------------------------------------------
# Include OpenCV library and copy the dlls on Windows
#--------------------------------------------------------------------
set(OpenCV_STATIC OFF)
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
target_link_libraries( ${PROJECT_NAME} ${OpenCV_LIBS} )
if(NOT OpenCV_STATIC)
if(WIN32)
if(MSVC AND OpenCV_RUNTIME AND OpenCV_ARCH)
set(OpenCV_LIB_PATH "${OpenCV_CONFIG_PATH}/${OpenCV_ARCH}/${OpenCV_RUNTIME}/bin")
file(GLOB OPENCV_DLL_FILES ${OpenCV_LIB_PATH}/*.*dll)
file(COPY ${OPENCV_DLL_FILES} DESTINATION ${CMAKE_BINARY_DIR})
else()
message(STATUS "Failed to find OpenCV binary folder. Please copy the dll files manually!")
endif()
endif()
endif()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment