From 85e043ec4404146b353cc02f01dff286091223a8 Mon Sep 17 00:00:00 2001 From: Zoltan Csizmadia Date: Sun, 6 Mar 2016 07:52:17 -0600 Subject: [PATCH] Update CMakeLists.txt --- CMakeLists.txt | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6068be0..f2116ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,11 +42,18 @@ endif() if(WIN32) list(APPEND DEPLIBS ws2_32 iphlpapi) else() - list(APPEND DEPLIBS pthread) - check_library_exists(rt clock_gettime "" HAS_LIBRT) - if (HAS_LIBRT) + check_library_exists(pthreads pthread_create HAVE_LIBTHREAD) + check_library_exists(socket getaddrinfo "" HAVE_LIBSOCKET) + check_library_exists(rt clock_gettime "" HAVE_LIBRT) + if (HAVE_LIBTHREADS) + list(APPEND DEPLIBS pthreads) + endif() + if (HAVE_LIBRT) list(APPEND DEPLIBS rt) - endif() + endif() + if (HAVE_LIBSOCKET) + list(APPEND DEPLIBS socket) + endif() endif() if(MSVC) @@ -57,6 +64,9 @@ endif() add_library(hdhomerun SHARED ${SOURCES}) target_link_libraries(hdhomerun ${DEPLIBS}) +add_library(hdhomerun_static STATIC ${SOURCES}) +target_link_libraries(hdhomerun_static ${DEPLIBS}) + if(WIN32) set_target_properties(hdhomerun PROPERTIES DEFINE_SYMBOL "LIBHDHOMERUN_DLLEXPORT") endif() @@ -67,7 +77,7 @@ target_link_libraries(hdhomerun_config hdhomerun) include_directories(${PROJECT_SOURCE_DIR}) install(FILES ${HEADERS} DESTINATION include/hdhomerun) -install(TARGETS hdhomerun hdhomerun_config +install(TARGETS hdhomerun hdhomerun_static hdhomerun_config RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib