cmake: fix static linking winpthread on MINGW

Include linker flags to link winpthread statically on MINGW when static
build is on.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2022-04-13 21:26:27 +00:00
parent cbd7d7d2d1
commit d91e5db524
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 7 additions and 2 deletions

View File

@ -469,8 +469,13 @@ if(ENABLE_LINK)
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} ${PTHREAD_LIB})
endif()
elseif(MINGW)
if(NOT VBAM_STATIC)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -lpthread)
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} -lpthread)
else()
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} "-Wl,-Bstatic -lwinpthread -Wl,-Bdynamic")
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} "-Wl,-Bstatic -lwinpthread -Wl,-Bdynamic")
endif()
endif()
include(CheckFunctionExists)