Check for rt and pthread libraries before linking
This fixes building on Android which does not have separate librt or libpthread libraries. Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
This commit is contained in:
parent
2c92d3b837
commit
35cc1eb21e
@ -7,7 +7,12 @@ if (${WITH_THREADING} STREQUAL ON)
|
|||||||
set (PTHREAD_LIBRARIES C:\\pthreads\\Pre-built.2\\lib\\x86\\pthreadVC2.lib)
|
set (PTHREAD_LIBRARIES C:\\pthreads\\Pre-built.2\\lib\\x86\\pthreadVC2.lib)
|
||||||
set (PTHREAD_INCLUDE_DIR C:\\pthreads\\Pre-built.2\\include)
|
set (PTHREAD_INCLUDE_DIR C:\\pthreads\\Pre-built.2\\include)
|
||||||
else (WIN32)
|
else (WIN32)
|
||||||
set (PTHREAD_LIBRARIES pthread)
|
find_library(LIBPTHREAD pthread)
|
||||||
|
if (LIBPTHREAD)
|
||||||
|
set (PTHREAD_LIBRARIES pthread)
|
||||||
|
else (LIBPTHREAD)
|
||||||
|
set (PTHREAD_LIBRARIES "")
|
||||||
|
endif()
|
||||||
set (PTHREAD_INCLUDE_DIR "")
|
set (PTHREAD_INCLUDE_DIR "")
|
||||||
endif (WIN32)
|
endif (WIN32)
|
||||||
else (${WITH_THREADING} STREQUAL ON)
|
else (${WITH_THREADING} STREQUAL ON)
|
||||||
@ -44,7 +49,10 @@ add_library(libmosquitto SHARED
|
|||||||
set (LIBRARIES ${OPENSSL_LIBRARIES} ${PTHREAD_LIBRARIES})
|
set (LIBRARIES ${OPENSSL_LIBRARIES} ${PTHREAD_LIBRARIES})
|
||||||
|
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
set (LIBRARIES ${LIBRARIES} rt)
|
find_library(LIBRT rt)
|
||||||
|
if (LIBRT)
|
||||||
|
set (LIBRARIES ${LIBRARIES} rt)
|
||||||
|
endif (LIBRT)
|
||||||
endif (UNIX AND NOT APPLE)
|
endif (UNIX AND NOT APPLE)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
|
@ -86,7 +86,11 @@ if (UNIX)
|
|||||||
if (APPLE)
|
if (APPLE)
|
||||||
set (MOSQ_LIBS ${MOSQ_LIBS} dl m)
|
set (MOSQ_LIBS ${MOSQ_LIBS} dl m)
|
||||||
else (APPLE)
|
else (APPLE)
|
||||||
set (MOSQ_LIBS ${MOSQ_LIBS} rt dl m)
|
set (MOSQ_LIBS ${MOSQ_LIBS} dl m)
|
||||||
|
find_library(LIBRT rt)
|
||||||
|
if (LIBRT)
|
||||||
|
set (MOSQ_LIBS ${MOSQ_LIBS} rt)
|
||||||
|
endif (LIBRT)
|
||||||
endif (APPLE)
|
endif (APPLE)
|
||||||
endif (UNIX)
|
endif (UNIX)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user