From f0718ff0a0d9f807ac98bbc8f028ba2f1c1c3577 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 14 Sep 2020 11:01:28 +0200 Subject: [PATCH] cmake: fix INSTALL_RPATH --- src/bin/CMakeLists.txt | 11 ++++++----- src/libhashkit/CMakeLists.txt | 7 +++++-- src/libmemcached/CMakeLists.txt | 7 +++++-- src/libmemcachedprotocol/CMakeLists.txt | 7 +++++-- src/libmemcachedutil/CMakeLists.txt | 7 +++++-- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/bin/CMakeLists.txt b/src/bin/CMakeLists.txt index a568dd1c..ee771891 100644 --- a/src/bin/CMakeLists.txt +++ b/src/bin/CMakeLists.txt @@ -13,7 +13,8 @@ target_include_directories(libclient_utilities PUBLIC foreach(CLIENT IN LISTS CLIENTS) add_executable(${CLIENT} ${CLIENT}.cc) target_include_directories(${CLIENT} PRIVATE ..) - target_link_libraries(${CLIENT} libclient_utilities) + target_link_libraries(${CLIENT} PRIVATE libclient_utilities) + set_target_properties(${CLIENT} PROPERTIES INSTALL_RPATH $ORIGIN/../${CMAKE_INSTALL_LIBDIR}) install(TARGETS ${CLIENT} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endforeach() @@ -24,9 +25,9 @@ target_sources(memcapable PRIVATE ../libmemcached/byteorder.cc) # extra libs -target_link_libraries(memcapable Threads::Threads) -target_link_libraries(memping libmemcachedutil) -target_link_libraries(memslap Threads::Threads) +target_link_libraries(memcapable PRIVATE Threads::Threads) +target_link_libraries(memping PRIVATE libmemcachedutil) +target_link_libraries(memslap PRIVATE Threads::Threads) # memaslap is special @@ -35,7 +36,7 @@ if(ENABLE_MEMASLAP) add_executable(memaslap memaslap.c ms_conn.c ms_setting.c ms_sigsegv.c ms_stats.c ms_task.c ms_thread.c) target_include_directories(memaslap PRIVATE ${LIBEVENT_INCLUDEDIR}) - target_link_libraries(memaslap libclient_utilities ${LIBEVENT_LIBRARIES} Threads::Threads) + target_link_libraries(memaslap PRIVATE libclient_utilities ${LIBEVENT_LIBRARIES} Threads::Threads) install(TARGETS memaslap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/src/libhashkit/CMakeLists.txt b/src/libhashkit/CMakeLists.txt index a75e08e7..f4657b61 100644 --- a/src/libhashkit/CMakeLists.txt +++ b/src/libhashkit/CMakeLists.txt @@ -31,7 +31,11 @@ add_library(libhashkit SHARED string.cc ) add_library(hashkit ALIAS libhashkit) -set_target_properties(libhashkit PROPERTIES LIBRARY_OUTPUT_NAME hashkit) +set_target_properties(libhashkit PROPERTIES + LIBRARY_OUTPUT_NAME hashkit + INSTALL_RPATH $ORIGIN + SOVERSION ${LIBHASHKIT_SO_VERSION} + VERSION v${LIBHASHKIT_VERSION}) target_compile_options(libhashkit PRIVATE -DBUILDING_HASHKIT) target_include_directories(libhashkit PRIVATE ${CMAKE_SOURCE_DIR}/src @@ -43,7 +47,6 @@ target_include_directories(libhashkit PUBLIC $) configure_file(hashkitcon.h.in hashkitcon.h @ONLY) -set_target_properties(libhashkit PROPERTIES SOVERSION ${LIBHASHKIT_SO_VERSION}) install(TARGETS libhashkit EXPORT libhashkit LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) export(EXPORT libhashkit) diff --git a/src/libmemcached/CMakeLists.txt b/src/libmemcached/CMakeLists.txt index 96338c9b..ff8993d0 100644 --- a/src/libmemcached/CMakeLists.txt +++ b/src/libmemcached/CMakeLists.txt @@ -89,7 +89,11 @@ set(LIBMEMCACHED_SOURCES add_library(libmemcached SHARED ${LIBMEMCACHED_SOURCES}) add_library(memcached ALIAS libmemcached) -set_target_properties(libmemcached PROPERTIES LIBRARY_OUTPUT_NAME memcached) +set_target_properties(libmemcached PROPERTIES + LIBRARY_OUTPUT_NAME memcached + INSTALL_RPATH $ORIGIN + SOVERSION ${LIBMEMCACHED_SO_VERSION} + VERSION v${LIBMEMCACHED_VERSION}) target_compile_definitions(libmemcached PRIVATE -DBUILDING_LIBMEMCACHED) target_link_libraries(libmemcached PUBLIC libhashkit Threads::Threads ${LIBSASL_LIBRARIES} ${CMAKE_DL_LIBS}) target_include_directories(libmemcached PRIVATE ${LIBSASL_INCLUDEDIR}) @@ -102,7 +106,6 @@ target_include_directories(libmemcached PUBLIC $ $) -set_target_properties(libmemcached PROPERTIES SOVERSION ${LIBMEMCACHED_SO_VERSION}) install(TARGETS libmemcached EXPORT libmemcached LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) export(EXPORT libmemcached) diff --git a/src/libmemcachedprotocol/CMakeLists.txt b/src/libmemcachedprotocol/CMakeLists.txt index a826e0aa..7080bd9e 100644 --- a/src/libmemcachedprotocol/CMakeLists.txt +++ b/src/libmemcachedprotocol/CMakeLists.txt @@ -8,7 +8,11 @@ add_library(libmemcachedprotocol SHARED pedantic.c ) add_library(memcachedprotocol ALIAS libmemcachedprotocol) -set_target_properties(libmemcachedprotocol PROPERTIES LIBRARY_OUTPUT_NAME memcachedprotocol) +set_target_properties(libmemcachedprotocol PROPERTIES + LIBRARY_OUTPUT_NAME memcachedprotocol + INSTALL_RPATH $ORIGIN + SOVERSION ${LIBMEMCACHEDPROTOCOL_SO_VERSION} + VERSION v${LIBMEMCACHEDPROTOCOL_VERSION}) target_compile_definitions(libmemcachedprotocol PRIVATE -DBUILDING_LIBMEMCACHED) target_link_libraries(libmemcachedprotocol PUBLIC libmemcached Threads::Threads) target_include_directories(libmemcachedprotocol PRIVATE @@ -20,7 +24,6 @@ target_include_directories(libmemcachedprotocol PUBLIC $ $) -set_target_properties(libmemcachedprotocol PROPERTIES SOVERSION ${LIBMEMCACHEDPROTOCOL_SO_VERSION}) install(TARGETS libmemcachedprotocol EXPORT libmemcachedprotocol LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) export(EXPORT libmemcachedprotocol) diff --git a/src/libmemcachedutil/CMakeLists.txt b/src/libmemcachedutil/CMakeLists.txt index d087d63d..cb281c3b 100644 --- a/src/libmemcachedutil/CMakeLists.txt +++ b/src/libmemcachedutil/CMakeLists.txt @@ -9,7 +9,11 @@ add_library(libmemcachedutil SHARED version.cc ) add_library(memcachedutil ALIAS libmemcachedutil) -set_target_properties(libmemcachedutil PROPERTIES LIBRARY_OUTPUT_NAME memcachedutil) +set_target_properties(libmemcachedutil PROPERTIES + LIBRARY_OUTPUT_NAME memcachedutil + INSTALL_RPATH $ORIGIN + SOVERSION ${LIBMEMCACHEDUTIL_SO_VERSION} + VERSION v${LIBMEMCACHEDUTIL_VERSION}) target_compile_definitions(libmemcachedutil PRIVATE -DBUILDING_LIBMEMCACHED) target_link_libraries(libmemcachedutil PUBLIC libmemcached Threads::Threads) target_include_directories(libmemcachedutil PRIVATE @@ -21,7 +25,6 @@ target_include_directories(libmemcachedutil PUBLIC $ $) -set_target_properties(libmemcachedutil PROPERTIES SOVERSION ${LIBMEMCACHEDUTIL_SO_VERSION}) install(TARGETS libmemcachedutil EXPORT libmemcachedutil LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) export(EXPORT libmemcachedutil) -- 2.30.2