diff --git a/CMakeLists.txt b/CMakeLists.txt index 43b6023242..3eac4b5dbc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -641,7 +641,7 @@ ocv_cmake_hook(POST_COMPILER_OPTIONS) # ---------------------------------------------------------------------------- # CHECK FOR SYSTEM LIBRARIES, OPTIONS, ETC.. # ---------------------------------------------------------------------------- -if(UNIX) +if(UNIX OR MINGW) if(NOT APPLE_FRAMEWORK OR OPENCV_ENABLE_PKG_CONFIG) if(CMAKE_CROSSCOMPILING AND NOT DEFINED ENV{PKG_CONFIG_LIBDIR} AND NOT DEFINED ENV{PKG_CONFIG_SYSROOT_DIR} AND NOT OPENCV_ENABLE_PKG_CONFIG @@ -673,6 +673,8 @@ if(UNIX) # no need to link to system libs with emscripten elseif(QNXNTO) set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} m) + elseif(MINGW) + set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} pthread) else() set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m pthread rt) endif() diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake index 43d6a87e74..8d36b74f09 100644 --- a/cmake/OpenCVGenPkgconfig.cmake +++ b/cmake/OpenCVGenPkgconfig.cmake @@ -103,7 +103,7 @@ add_custom_target(gen-pkgconfig ALL SOURCES "${CMAKE_BINARY_DIR}/unix-install/${ add_dependencies(developer_scripts gen-pkgconfig) -if(UNIX AND NOT ANDROID) +if((UNIX AND NOT ANDROID) OR MINGW) install(FILES ${CMAKE_BINARY_DIR}/unix-install/${OPENCV_PC_FILE_NAME} DESTINATION ${OPENCV_LIB_INSTALL_PATH}/pkgconfig COMPONENT dev) endif()