diff --git a/CMakeLists.txt b/CMakeLists.txt index d30231e6..0c89289b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,11 +126,19 @@ ADD_DEFINITIONS (-DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DHAVE_ZLIB_H -DFINAL_VE ADD_DEFINITIONS (-DVERSION='"${VERSION}"' -DPKGDATADIR='"${PKGDATADIR}"' -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 ${RT_LIB}) + SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${RT_LIB}) SET(VBAMCORE_LIBS ${VBAMCORE_LIBS} ${RT_LIB}) ENDIF(RT_LIB) + + 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(PTHREAD_LIB) + INCLUDE(CheckFunctionExists) CHECK_FUNCTION_EXISTS(sem_timedwait SEM_TIMEDWAIT) IF( SEM_TIMEDWAIT)