Skip to content

Commit

Permalink
msys2: don't try to link msys librt and libpthread
Browse files Browse the repository at this point in the history
In cmake on Win32, don't try to find librt or libpthread using
find_library(), and on mingw just include -lpthread.

For some reason the msys versions of librt and libpthread were being
picked up when find_library() was being used.
  • Loading branch information
rkitover committed Aug 10, 2018
1 parent 65e1ab0 commit 0092dc1
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions CMakeLists.txt
Expand Up @@ -253,16 +253,23 @@ add_definitions(-DPKGDATADIR="${CMAKE_INSTALL_FULL_DATADIR}/vbam" -DPACKAGE=)

if(ENABLE_LINK)
# IPC linking code needs sem_timedwait which can be either in librt or pthreads
find_library(RT_LIB rt)
if(RT_LIB)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${RT_LIB})
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} ${RT_LIB})
if(NOT WIN32)
find_library(RT_LIB rt)
if(RT_LIB)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${RT_LIB})
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} ${RT_LIB})
endif()
endif()

find_library(PTHREAD_LIB pthread)
if(PTHREAD_LIB)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${PTHREAD_LIB})
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} ${PTHREAD_LIB})
if(NOT WIN32)
find_library(PTHREAD_LIB pthread)
if(PTHREAD_LIB)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${PTHREAD_LIB})
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} ${PTHREAD_LIB})
endif()
elseif(MINGW)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -lpthread)
set(VBAMCORE_LIBS ${VBAMCORE_LIBS} -lpthread)
endif()

include(CheckFunctionExists)
Expand Down

0 comments on commit 0092dc1

Please sign in to comment.