From acd09461d3c796751a0ea07ea69d81e7ce264320 Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Thu, 22 Dec 2022 23:00:56 +0100 Subject: CMakeLists.txt: respect BUILD_SHARED_LIBS To allow building hiredis on toolchain without dynamic library support, respect standard cmake BUILD_SHARED_LIBS: https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html Signed-off-by: Fabrice Fontaine --- examples/CMakeLists.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'examples') diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 214898b..a208401 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -6,7 +6,7 @@ if (GLIB2_FOUND) INCLUDE_DIRECTORIES(${GLIB2_INCLUDE_DIRS}) LINK_DIRECTORIES(${GLIB2_LIBRARY_DIRS}) ADD_EXECUTABLE(example-glib example-glib.c) - TARGET_LINK_LIBRARIES(example-glib hiredis ${GLIB2_LIBRARIES}) + TARGET_LINK_LIBRARIES(example-glib ${HIREDIS_DEFAULT_LIBRARY} ${GLIB2_LIBRARIES}) ENDIF(GLIB2_FOUND) FIND_PATH(LIBEV ev.h @@ -16,46 +16,46 @@ FIND_PATH(LIBEV ev.h if (LIBEV) # Just compile and link with libev ADD_EXECUTABLE(example-libev example-libev.c) - TARGET_LINK_LIBRARIES(example-libev hiredis ev) + TARGET_LINK_LIBRARIES(example-libev ${HIREDIS_DEFAULT_LIBRARY} ev) ENDIF() FIND_PATH(LIBEVENT event.h) if (LIBEVENT) ADD_EXECUTABLE(example-libevent example-libevent.c) - TARGET_LINK_LIBRARIES(example-libevent hiredis event) + TARGET_LINK_LIBRARIES(example-libevent ${HIREDIS_DEFAULT_LIBRARY} event) ENDIF() FIND_PATH(LIBHV hv/hv.h) IF (LIBHV) ADD_EXECUTABLE(example-libhv example-libhv.c) - TARGET_LINK_LIBRARIES(example-libhv hiredis hv) + TARGET_LINK_LIBRARIES(example-libhv ${HIREDIS_DEFAULT_LIBRARY} hv) ENDIF() FIND_PATH(LIBUV uv.h) IF (LIBUV) ADD_EXECUTABLE(example-libuv example-libuv.c) - TARGET_LINK_LIBRARIES(example-libuv hiredis uv) + TARGET_LINK_LIBRARIES(example-libuv ${HIREDIS_DEFAULT_LIBRARY} uv) ENDIF() FIND_PATH(LIBSDEVENT systemd/sd-event.h) IF (LIBSDEVENT) ADD_EXECUTABLE(example-libsdevent example-libsdevent.c) - TARGET_LINK_LIBRARIES(example-libsdevent hiredis systemd) + TARGET_LINK_LIBRARIES(example-libsdevent ${HIREDIS_DEFAULT_LIBRARY} systemd) ENDIF() IF (APPLE) FIND_LIBRARY(CF CoreFoundation) ADD_EXECUTABLE(example-macosx example-macosx.c) - TARGET_LINK_LIBRARIES(example-macosx hiredis ${CF}) + TARGET_LINK_LIBRARIES(example-macosx ${HIREDIS_DEFAULT_LIBRARY} ${CF}) ENDIF() IF (ENABLE_SSL) ADD_EXECUTABLE(example-ssl example-ssl.c) - TARGET_LINK_LIBRARIES(example-ssl hiredis hiredis_ssl) + TARGET_LINK_LIBRARIES(example-ssl ${HIREDIS_DEFAULT_LIBRARY} ${HIREDIS_SSL_DEFAULT_LIBRARY}) ENDIF() ADD_EXECUTABLE(example example.c) -TARGET_LINK_LIBRARIES(example hiredis) +TARGET_LINK_LIBRARIES(example ${HIREDIS_DEFAULT_LIBRARY}) ADD_EXECUTABLE(example-push example-push.c) -TARGET_LINK_LIBRARIES(example-push hiredis) +TARGET_LINK_LIBRARIES(example-push ${HIREDIS_DEFAULT_LIBRARY}) -- cgit v1.2.3