cmake: Enable pkgconfig support for mingw

This commit is contained in:
Biswapriyo Nath 2022-08-21 12:06:46 +05:30
parent 925ff6241f
commit 7e5d012f75
2 changed files with 4 additions and 2 deletions

View File

@ -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()

View File

@ -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()