diff --git a/CMakeLists.txt b/CMakeLists.txt index 7885f24f..4c42f74c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -469,8 +469,13 @@ if(ENABLE_LINK) set(VBAMCORE_LIBS ${VBAMCORE_LIBS} ${PTHREAD_LIB}) endif() elseif(MINGW) - set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -lpthread) - set(VBAMCORE_LIBS ${VBAMCORE_LIBS} -lpthread) + 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)