diff options
author | autoantwort <41973254+autoantwort@users.noreply.github.com> | 2023-03-08 02:05:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-07 17:05:25 -0800 |
commit | e9243d4f706ab760f6c0f096d62e540ab2544c61 (patch) | |
tree | fb3fc37f7e6365c900317fcc37013800b816dae8 /examples | |
parent | 1cbd5bc762a466e196f78aae7ea6d5c8c5c51fe5 (diff) |
Cmake static or shared (#1160)
* cmake: build either static or shared libs
* cmake: allow to build non-PIC static libs
* fix typo
* cmake: add ALIAS targets
* cmake: link to OpenSSL imported targets
CMake imported targets are more robust
* turn ENABLE_EXAMPLES to a CMake option
* fix typo
* install pdb files if shared
* fix hiredis_ssl-config file
* Fix more targets
* CMake knows when to enable CMAKE_POSITION_INDEPENDENT_CODE
* Restore setting of /Z7
* [ci] fix building of shared and static libs
* Apply suggestions from code review
Co-authored-by: Bjorn Svensson <bjorn.a.svensson@est.tech>
* Make it possible to change name of exported target
---------
Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com>
Co-authored-by: Bjorn Svensson <bjorn.a.svensson@est.tech>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/CMakeLists.txt | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index a208401..214898b 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_DEFAULT_LIBRARY} ${GLIB2_LIBRARIES}) + TARGET_LINK_LIBRARIES(example-glib hiredis ${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_DEFAULT_LIBRARY} ev) + TARGET_LINK_LIBRARIES(example-libev hiredis ev) ENDIF() FIND_PATH(LIBEVENT event.h) if (LIBEVENT) ADD_EXECUTABLE(example-libevent example-libevent.c) - TARGET_LINK_LIBRARIES(example-libevent ${HIREDIS_DEFAULT_LIBRARY} event) + TARGET_LINK_LIBRARIES(example-libevent hiredis event) ENDIF() FIND_PATH(LIBHV hv/hv.h) IF (LIBHV) ADD_EXECUTABLE(example-libhv example-libhv.c) - TARGET_LINK_LIBRARIES(example-libhv ${HIREDIS_DEFAULT_LIBRARY} hv) + TARGET_LINK_LIBRARIES(example-libhv hiredis hv) ENDIF() FIND_PATH(LIBUV uv.h) IF (LIBUV) ADD_EXECUTABLE(example-libuv example-libuv.c) - TARGET_LINK_LIBRARIES(example-libuv ${HIREDIS_DEFAULT_LIBRARY} uv) + TARGET_LINK_LIBRARIES(example-libuv hiredis uv) ENDIF() FIND_PATH(LIBSDEVENT systemd/sd-event.h) IF (LIBSDEVENT) ADD_EXECUTABLE(example-libsdevent example-libsdevent.c) - TARGET_LINK_LIBRARIES(example-libsdevent ${HIREDIS_DEFAULT_LIBRARY} systemd) + TARGET_LINK_LIBRARIES(example-libsdevent hiredis systemd) ENDIF() IF (APPLE) FIND_LIBRARY(CF CoreFoundation) ADD_EXECUTABLE(example-macosx example-macosx.c) - TARGET_LINK_LIBRARIES(example-macosx ${HIREDIS_DEFAULT_LIBRARY} ${CF}) + TARGET_LINK_LIBRARIES(example-macosx hiredis ${CF}) ENDIF() IF (ENABLE_SSL) ADD_EXECUTABLE(example-ssl example-ssl.c) - TARGET_LINK_LIBRARIES(example-ssl ${HIREDIS_DEFAULT_LIBRARY} ${HIREDIS_SSL_DEFAULT_LIBRARY}) + TARGET_LINK_LIBRARIES(example-ssl hiredis hiredis_ssl) ENDIF() ADD_EXECUTABLE(example example.c) -TARGET_LINK_LIBRARIES(example ${HIREDIS_DEFAULT_LIBRARY}) +TARGET_LINK_LIBRARIES(example hiredis) ADD_EXECUTABLE(example-push example-push.c) -TARGET_LINK_LIBRARIES(example-push ${HIREDIS_DEFAULT_LIBRARY}) +TARGET_LINK_LIBRARIES(example-push hiredis) |