From: Michael Wallner Date: Tue, 15 Sep 2020 06:27:51 +0000 (+0200) Subject: cmake: IMPORT, EXPORT and RPATH improvements X-Git-Tag: 1.1.0-beta1~236^2~69 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=785f671d065aa12941a98fca384248ac5cd6e527;p=m6w6%2Flibmemcached cmake: IMPORT, EXPORT and RPATH improvements --- diff --git a/CMake/_Include.cmake b/CMake/_Include.cmake index 00da54f9..3b264670 100644 --- a/CMake/_Include.cmake +++ b/CMake/_Include.cmake @@ -3,8 +3,10 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) # globals include(CTest) include(GNUInstallDirs) +include(CMakePackageConfigHelpers) find_package(PkgConfig) +set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) # locals diff --git a/CMakeConfig.txt b/CMakeConfig.txt index 41b76324..0d584981 100644 --- a/CMakeConfig.txt +++ b/CMakeConfig.txt @@ -3,6 +3,15 @@ set(CMAKE_BUILD_TYPE Release set(CMAKE_INSTALL_PREFIX /usr/local CACHE PATH "install prefix") +if(APPLE) + set(CMAKE_INSTALL_RPATH @loader_path + CACHE STRING "set relative rpath") +elseif(UNIX) + # FIXME + set(CMAKE_INSTALL_RPATH $ORIGIN + CACHE STRING "set relative rpath") +endif() + option(BUILD_TESTING "whether to enable build of the test suite" OFF) option(BUILD_DOCSONLY "build *only* documentation" diff --git a/src/bin/CMakeLists.txt b/src/bin/CMakeLists.txt index ee771891..5e08ac64 100644 --- a/src/bin/CMakeLists.txt +++ b/src/bin/CMakeLists.txt @@ -14,7 +14,10 @@ foreach(CLIENT IN LISTS CLIENTS) add_executable(${CLIENT} ${CLIENT}.cc) target_include_directories(${CLIENT} PRIVATE ..) target_link_libraries(${CLIENT} PRIVATE libclient_utilities) - set_target_properties(${CLIENT} PROPERTIES INSTALL_RPATH $ORIGIN/../${CMAKE_INSTALL_LIBDIR}) + if(CMAKE_INSTALL_RPATH) + set_target_properties(${CLIENT} PROPERTIES + INSTALL_RPATH ${CMAKE_INSTALL_RPATH}/../${CMAKE_INSTALL_LIBDIR}) + endif() install(TARGETS ${CLIENT} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endforeach() @@ -37,6 +40,10 @@ if(ENABLE_MEMASLAP) 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 PRIVATE libclient_utilities ${LIBEVENT_LIBRARIES} Threads::Threads) + if(CMAKE_INSTALL_RPATH) + set_target_properties(${CLIENT} PROPERTIES + INSTALL_RPATH ${CMAKE_INSTALL_RPATH}/../${CMAKE_INSTALL_LIBDIR}) + endif() install(TARGETS memaslap RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/src/libhashkit/CMakeLists.txt b/src/libhashkit/CMakeLists.txt index f4657b61..ffe4026b 100644 --- a/src/libhashkit/CMakeLists.txt +++ b/src/libhashkit/CMakeLists.txt @@ -33,7 +33,7 @@ add_library(libhashkit SHARED add_library(hashkit ALIAS libhashkit) set_target_properties(libhashkit PROPERTIES LIBRARY_OUTPUT_NAME hashkit - INSTALL_RPATH $ORIGIN + LIBRARY_OUTPUT_NAME_DEBUG hashkit-dbg SOVERSION ${LIBHASHKIT_SO_VERSION} VERSION v${LIBHASHKIT_VERSION}) target_compile_options(libhashkit PRIVATE -DBUILDING_HASHKIT) @@ -47,10 +47,10 @@ target_include_directories(libhashkit PUBLIC $) configure_file(hashkitcon.h.in hashkitcon.h @ONLY) -install(TARGETS libhashkit EXPORT libhashkit +install(TARGETS libhashkit EXPORT libhashkit-targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -export(EXPORT libhashkit) -install(EXPORT libhashkit DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake) +export(EXPORT libhashkit-targets NAMESPACE libmemcached::) +install(EXPORT libhashkit-targets NAMESPACE libmemcached:: DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake) install_public_headers( libhashkit diff --git a/src/libmemcached/CMakeLists.txt b/src/libmemcached/CMakeLists.txt index ff8993d0..a029ac58 100644 --- a/src/libmemcached/CMakeLists.txt +++ b/src/libmemcached/CMakeLists.txt @@ -11,9 +11,11 @@ bison_target(CSL_PARSER csl/parser.yy ${CMAKE_CURRENT_BINARY_DIR}/csl/parser.cc DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/csl/parser.h COMPILE_FLAGS ${BISON_WARNINGS} ) +set_source_files_properties(${BISON_CSL_PARSER_OUTPUTS} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON) flex_target(CSL_SCANNER csl/scanner.l ${CMAKE_CURRENT_BINARY_DIR}/csl/scanner.cc DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/csl/scanner.h ) +set_source_files_properties(${FLEX_CSL_SCANNER_OUTPUTS} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON) add_flex_bison_dependency(CSL_SCANNER CSL_PARSER) if(HAVE_DTRACE) @@ -91,7 +93,7 @@ add_library(libmemcached SHARED add_library(memcached ALIAS libmemcached) set_target_properties(libmemcached PROPERTIES LIBRARY_OUTPUT_NAME memcached - INSTALL_RPATH $ORIGIN + LIBRARY_OUTPUT_NAME_DEBUG memcached-dbg SOVERSION ${LIBMEMCACHED_SO_VERSION} VERSION v${LIBMEMCACHED_VERSION}) target_compile_definitions(libmemcached PRIVATE -DBUILDING_LIBMEMCACHED) @@ -106,10 +108,10 @@ target_include_directories(libmemcached PUBLIC $ $) -install(TARGETS libmemcached EXPORT libmemcached +install(TARGETS libmemcached EXPORT libmemcached-targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -export(EXPORT libmemcached) -install(EXPORT libmemcached DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake) +export(EXPORT libmemcached-targets NAMESPACE libmemcached::) +install(EXPORT libmemcached-targets NAMESPACE libmemcached:: DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake) install_public_headers( libmemcached diff --git a/src/libmemcachedprotocol/CMakeLists.txt b/src/libmemcachedprotocol/CMakeLists.txt index 7080bd9e..14967dd5 100644 --- a/src/libmemcachedprotocol/CMakeLists.txt +++ b/src/libmemcachedprotocol/CMakeLists.txt @@ -10,7 +10,7 @@ add_library(libmemcachedprotocol SHARED add_library(memcachedprotocol ALIAS libmemcachedprotocol) set_target_properties(libmemcachedprotocol PROPERTIES LIBRARY_OUTPUT_NAME memcachedprotocol - INSTALL_RPATH $ORIGIN + LIBRARY_OUTPUT_NAME_DEBUG memcachedprotocol-dbg SOVERSION ${LIBMEMCACHEDPROTOCOL_SO_VERSION} VERSION v${LIBMEMCACHEDPROTOCOL_VERSION}) target_compile_definitions(libmemcachedprotocol PRIVATE -DBUILDING_LIBMEMCACHED) @@ -24,7 +24,7 @@ target_include_directories(libmemcachedprotocol PUBLIC $ $) -install(TARGETS libmemcachedprotocol EXPORT libmemcachedprotocol +install(TARGETS libmemcachedprotocol EXPORT libmemcachedprotocol-targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -export(EXPORT libmemcachedprotocol) -install(EXPORT libmemcachedprotocol DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake) +export(EXPORT libmemcachedprotocol-targets NAMESPACE libmemcached::) +install(EXPORT libmemcachedprotocol-targets NAMESPACE libmemcached:: DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake) diff --git a/src/libmemcachedprotocol/ascii_handler.c b/src/libmemcachedprotocol/ascii_handler.c index a6ecadab..44c70e0d 100644 --- a/src/libmemcachedprotocol/ascii_handler.c +++ b/src/libmemcachedprotocol/ascii_handler.c @@ -162,7 +162,7 @@ static uint16_t parse_ascii_key(char **start) * @param text the text to spool * @return status of the spool operation */ -static protocol_binary_response_status raw_response_handler(memcached_protocol_client_st *client, const char *text) +static protocol_binary_response_status ascii_raw_response_handler(memcached_protocol_client_st *client, const char *text) { if (client->is_verbose) { @@ -238,7 +238,7 @@ static void send_command_usage(memcached_protocol_client_st *client) }; client->mute = false; - raw_response_handler(client, errmsg[client->ascii_command]); + ascii_raw_response_handler(client, errmsg[client->ascii_command]); } /** @@ -252,9 +252,9 @@ static protocol_binary_response_status ascii_version_response_handler(const void uint32_t textlen) { memcached_protocol_client_st *client= (memcached_protocol_client_st*)cookie; - raw_response_handler(client, "VERSION "); + ascii_raw_response_handler(client, "VERSION "); client->root->spool(client, text, textlen); - raw_response_handler(client, "\r\n"); + ascii_raw_response_handler(client, "\r\n"); return PROTOCOL_BINARY_RESPONSE_SUCCESS; } @@ -336,15 +336,15 @@ static protocol_binary_response_status ascii_stat_response_handler(const void *c if (key != NULL) { - raw_response_handler(client, "STAT "); + ascii_raw_response_handler(client, "STAT "); client->root->spool(client, key, keylen); - raw_response_handler(client, " "); + ascii_raw_response_handler(client, " "); client->root->spool(client, body, bodylen); - raw_response_handler(client, "\r\n"); + ascii_raw_response_handler(client, "\r\n"); } else { - raw_response_handler(client, "END\r\n"); + ascii_raw_response_handler(client, "END\r\n"); } return PROTOCOL_BINARY_RESPONSE_SUCCESS; @@ -525,7 +525,7 @@ static void process_delete(memcached_protocol_client_st *client, if (client->root->callback->interface.v1.delete_object == NULL) { - raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); + ascii_raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); return; } @@ -533,17 +533,17 @@ static void process_delete(memcached_protocol_client_st *client, if (rval == PROTOCOL_BINARY_RESPONSE_SUCCESS) { - raw_response_handler(client, "DELETED\r\n"); + ascii_raw_response_handler(client, "DELETED\r\n"); } else if (rval == PROTOCOL_BINARY_RESPONSE_KEY_ENOENT) { - raw_response_handler(client, "NOT_FOUND\r\n"); + ascii_raw_response_handler(client, "NOT_FOUND\r\n"); } else { char msg[80]; snprintf(msg, sizeof(msg), "SERVER_ERROR: delete_object failed %u\r\n",(uint32_t)rval); - raw_response_handler(client, msg); + ascii_raw_response_handler(client, msg); } } @@ -573,7 +573,7 @@ static void process_arithmetic(memcached_protocol_client_st *client, { if (client->root->callback->interface.v1.increment == NULL) { - raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); + ascii_raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); return; } rval= client->root->callback->interface.v1.increment(client, @@ -587,7 +587,7 @@ static void process_arithmetic(memcached_protocol_client_st *client, { if (client->root->callback->interface.v1.decrement == NULL) { - raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); + ascii_raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); return; } rval= client->root->callback->interface.v1.decrement(client, @@ -602,11 +602,11 @@ static void process_arithmetic(memcached_protocol_client_st *client, { char buffer[80]; snprintf(buffer, sizeof(buffer), "%"PRIu64"\r\n", result); - raw_response_handler(client, buffer); + ascii_raw_response_handler(client, buffer); } else { - raw_response_handler(client, "NOT_FOUND\r\n"); + ascii_raw_response_handler(client, "NOT_FOUND\r\n"); } } @@ -620,7 +620,7 @@ static void process_stats(memcached_protocol_client_st *client, { if (client->root->callback->interface.v1.stat == NULL) { - raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); + ascii_raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); return; } @@ -646,7 +646,7 @@ static void process_version(memcached_protocol_client_st *client, if (client->root->callback->interface.v1.version == NULL) { - raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); + ascii_raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); return; } @@ -665,7 +665,7 @@ static void process_flush(memcached_protocol_client_st *client, if (client->root->callback->interface.v1.flush_object == NULL) { - raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); + ascii_raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); return; } @@ -683,9 +683,9 @@ static void process_flush(memcached_protocol_client_st *client, protocol_binary_response_status rval; rval= client->root->callback->interface.v1.flush_object(client, timeout); if (rval == PROTOCOL_BINARY_RESPONSE_SUCCESS) - raw_response_handler(client, "OK\r\n"); + ascii_raw_response_handler(client, "OK\r\n"); else - raw_response_handler(client, "SERVER_ERROR: internal error\r\n"); + ascii_raw_response_handler(client, "SERVER_ERROR: internal error\r\n"); } /** @@ -712,7 +712,7 @@ static inline int process_storage_command(memcached_protocol_client_st *client, if (nkey == 0) { /* return error */ - raw_response_handler(client, "CLIENT_ERROR: bad key\r\n"); + ascii_raw_response_handler(client, "CLIENT_ERROR: bad key\r\n"); return -1; } @@ -721,7 +721,7 @@ static inline int process_storage_command(memcached_protocol_client_st *client, if (errno != 0) { /* return error */ - raw_response_handler(client, "CLIENT_ERROR: bad key\r\n"); + ascii_raw_response_handler(client, "CLIENT_ERROR: bad key\r\n"); return -1; } @@ -729,7 +729,7 @@ static inline int process_storage_command(memcached_protocol_client_st *client, if (errno != 0) { /* return error */ - raw_response_handler(client, "CLIENT_ERROR: bad key\r\n"); + ascii_raw_response_handler(client, "CLIENT_ERROR: bad key\r\n"); return -1; } @@ -737,7 +737,7 @@ static inline int process_storage_command(memcached_protocol_client_st *client, if (errno != 0) { /* return error */ - raw_response_handler(client, "CLIENT_ERROR: bad key\r\n"); + ascii_raw_response_handler(client, "CLIENT_ERROR: bad key\r\n"); return -1; } @@ -779,7 +779,7 @@ static inline int process_storage_command(memcached_protocol_client_st *client, if (errno != 0) { /* return error */ - raw_response_handler(client, "CLIENT_ERROR: bad key\r\n"); + ascii_raw_response_handler(client, "CLIENT_ERROR: bad key\r\n"); return -1; } /* FALLTHROUGH */ @@ -827,7 +827,7 @@ static inline int process_storage_command(memcached_protocol_client_st *client, if (rval == PROTOCOL_BINARY_RESPONSE_SUCCESS) { - raw_response_handler(client, "STORED\r\n"); + ascii_raw_response_handler(client, "STORED\r\n"); } else { @@ -835,20 +835,20 @@ static inline int process_storage_command(memcached_protocol_client_st *client, { if (rval == PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS) { - raw_response_handler(client, "EXISTS\r\n"); + ascii_raw_response_handler(client, "EXISTS\r\n"); } else if (rval == PROTOCOL_BINARY_RESPONSE_KEY_ENOENT) { - raw_response_handler(client, "NOT_FOUND\r\n"); + ascii_raw_response_handler(client, "NOT_FOUND\r\n"); } else { - raw_response_handler(client, "NOT_STORED\r\n"); + ascii_raw_response_handler(client, "NOT_STORED\r\n"); } } else { - raw_response_handler(client, "NOT_STORED\r\n"); + ascii_raw_response_handler(client, "NOT_STORED\r\n"); } } @@ -869,7 +869,7 @@ static int process_cas_command(memcached_protocol_client_st *client, if (client->root->callback->interface.v1.replace == NULL) { - raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); + ascii_raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); return false; } @@ -888,7 +888,7 @@ static int process_set_command(memcached_protocol_client_st *client, if (client->root->callback->interface.v1.set == NULL) { - raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); + ascii_raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); return false; } @@ -907,7 +907,7 @@ static int process_add_command(memcached_protocol_client_st *client, if (client->root->callback->interface.v1.add == NULL) { - raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); + ascii_raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); return false; } @@ -926,7 +926,7 @@ static int process_replace_command(memcached_protocol_client_st *client, if (client->root->callback->interface.v1.replace == NULL) { - raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); + ascii_raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); return false; } @@ -945,7 +945,7 @@ static int process_append_command(memcached_protocol_client_st *client, if (client->root->callback->interface.v1.append == NULL) { - raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); + ascii_raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); return false; } @@ -964,7 +964,7 @@ static int process_prepend_command(memcached_protocol_client_st *client, if (client->root->callback->interface.v1.prepend == NULL) { - raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); + ascii_raw_response_handler(client, "SERVER_ERROR: callback not implemented\r\n"); return false; } @@ -1012,7 +1012,7 @@ memcached_protocol_event_t memcached_ascii_protocol_process_data(memcached_proto } else { - raw_response_handler(client, "SERVER_ERROR: Command not implemented\n"); + ascii_raw_response_handler(client, "SERVER_ERROR: Command not implemented\n"); } } else @@ -1120,7 +1120,7 @@ memcached_protocol_event_t memcached_ascii_protocol_process_data(memcached_proto } else { - raw_response_handler(client, "OK\r\n"); + ascii_raw_response_handler(client, "OK\r\n"); } break; diff --git a/src/libmemcachedprotocol/binary_handler.c b/src/libmemcachedprotocol/binary_handler.c index 37cd3778..8435cc98 100644 --- a/src/libmemcachedprotocol/binary_handler.c +++ b/src/libmemcachedprotocol/binary_handler.c @@ -59,7 +59,7 @@ * @param response the packet to send * @return The status of the operation */ -static protocol_binary_response_status raw_response_handler(const void *cookie, +static protocol_binary_response_status binary_raw_response_handler(const void *cookie, protocol_binary_request_header *request, protocol_binary_response_header *response) { @@ -1055,14 +1055,14 @@ static protocol_binary_response_status execute_command(memcached_protocol_client case 0: if (client->root->callback->interface.v0.comcode[cc] != NULL) { - rval= client->root->callback->interface.v0.comcode[cc](client, header, raw_response_handler); + rval= client->root->callback->interface.v0.comcode[cc](client, header, binary_raw_response_handler); } break; case 1: if (comcode_v0_v1_remap[cc] != NULL) { - rval= comcode_v0_v1_remap[cc](client, header, raw_response_handler); + rval= comcode_v0_v1_remap[cc](client, header, binary_raw_response_handler); } break; @@ -1078,7 +1078,7 @@ static protocol_binary_response_status execute_command(memcached_protocol_client if (rval == PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND && client->root->callback->unknown != NULL) { - rval= client->root->callback->unknown(client, header, raw_response_handler); + rval= client->root->callback->unknown(client, header, binary_raw_response_handler); } if (rval != PROTOCOL_BINARY_RESPONSE_SUCCESS && @@ -1095,7 +1095,7 @@ static protocol_binary_response_status execute_command(memcached_protocol_client }, } }; - rval= raw_response_handler(client, header, (void*)&response); + rval= binary_raw_response_handler(client, header, (void *) &response); } if (client->root->callback->post_execute != NULL) @@ -1183,7 +1183,7 @@ void memcached_binary_protocol_set_callbacks(memcached_protocol_st *instance, me memcached_binary_protocol_raw_response_handler memcached_binary_protocol_get_raw_response_handler(const void *cookie) { (void)cookie; - return raw_response_handler; + return binary_raw_response_handler; } void memcached_binary_protocol_set_pedantic(memcached_protocol_st *instance, bool enable) diff --git a/src/libmemcachedutil/CMakeLists.txt b/src/libmemcachedutil/CMakeLists.txt index cb281c3b..56fb0b08 100644 --- a/src/libmemcachedutil/CMakeLists.txt +++ b/src/libmemcachedutil/CMakeLists.txt @@ -11,7 +11,7 @@ add_library(libmemcachedutil SHARED add_library(memcachedutil ALIAS libmemcachedutil) set_target_properties(libmemcachedutil PROPERTIES LIBRARY_OUTPUT_NAME memcachedutil - INSTALL_RPATH $ORIGIN + LIBRARY_OUTPUT_NAME_DEBUG memcachedutil-dbg SOVERSION ${LIBMEMCACHEDUTIL_SO_VERSION} VERSION v${LIBMEMCACHEDUTIL_VERSION}) target_compile_definitions(libmemcachedutil PRIVATE -DBUILDING_LIBMEMCACHED) @@ -25,7 +25,7 @@ target_include_directories(libmemcachedutil PUBLIC $ $) -install(TARGETS libmemcachedutil EXPORT libmemcachedutil +install(TARGETS libmemcachedutil EXPORT libmemcachedutil-targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -export(EXPORT libmemcachedutil) -install(EXPORT libmemcachedutil DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake) +export(EXPORT libmemcachedutil-targets NAMESPACE libmemcached::) +install(EXPORT libmemcachedutil-targets NAMESPACE libmemcached:: DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake) diff --git a/support/CMakeLists.txt b/support/CMakeLists.txt index d3f877bd..beefd5da 100644 --- a/support/CMakeLists.txt +++ b/support/CMakeLists.txt @@ -5,7 +5,7 @@ install(FILES ax_libmemcached.m4 configure_file(example.cnf.in example.cnf @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/example.cnf - DESTINATION ${CMAKE_INSTALL_DATADIR}/libmemcached + DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME} ) configure_file(libmemcached.pc.in libmemcached.pc @ONLY) @@ -21,3 +21,26 @@ if(BUILD_TESTING) configure_file(memcached.pwdb.in memcached.pwdb @ONLY) configure_file(memcached.conf.in memcached.conf @ONLY) endif() + +configure_package_config_file(libmemcached-config.cmake.in + libmemcached-config.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake/) +write_basic_package_version_file(libhashkit-version.cmake + VERSION ${LIBHASHKIT_VERSION} + COMPATIBILITY SameMajorVersion) +write_basic_package_version_file(libmemcached-version.cmake + VERSION ${LIBMEMCACHED_VERSION} + COMPATIBILITY SameMajorVersion) +write_basic_package_version_file(libmemcachedprotocol-version.cmake + VERSION ${LIBMEMCACHEDPROTOCOL_VERSION} + COMPATIBILITY SameMajorVersion) +write_basic_package_version_file(libmemcachedutil-version.cmake + VERSION ${LIBMEMCACHEDUTIL_VERSION} + COMPATIBILITY SameMajorVersion) +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/libmemcached-config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/libhashkit-version.cmake + ${CMAKE_CURRENT_BINARY_DIR}/libmemcached-version.cmake + ${CMAKE_CURRENT_BINARY_DIR}/libmemcachedprotocol-version.cmake + ${CMAKE_CURRENT_BINARY_DIR}/libmemcachedutil-version.cmake + DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake/) diff --git a/support/libmemcached-config.cmake.in b/support/libmemcached-config.cmake.in new file mode 100644 index 00000000..d6fd629b --- /dev/null +++ b/support/libmemcached-config.cmake.in @@ -0,0 +1,10 @@ +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) +find_dependency(Threads) + +include(${CMAKE_CURRENT_LIST_DIR}/libhashkit-targets.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/libmemcached-targets.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/libmemcachedprotocol-targets.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/libmemcachedutil-targets.cmake) +