From: Michael Wallner Date: Tue, 7 Feb 2023 20:59:00 +0000 (+0100) Subject: fix #132: build static libs X-Git-Tag: 1.1.4~14^2~1 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=e7609e362789d817bcca52955fe8d3d8a29e187f;p=awesomized%2Flibmemcached fix #132: build static libs --- diff --git a/CMakeConfig.txt b/CMakeConfig.txt index d8afcaef..714ee94e 100644 --- a/CMakeConfig.txt +++ b/CMakeConfig.txt @@ -23,6 +23,8 @@ else() set(TARGET_NAMELINK_COMPONENT NAMELINK_COMPONENT dev DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() +option(BUILD_SHARED_LIBS "whether to build shared libraries" + ON) option(BUILD_TESTING "whether to enable build of the test suite" $ENV{BUILD_TESTING}) option(BUILD_DOCSONLY "build *only* documentation" diff --git a/src/libhashkit/CMakeLists.txt b/src/libhashkit/CMakeLists.txt index fb732fcf..9ed0a3ac 100644 --- a/src/libhashkit/CMakeLists.txt +++ b/src/libhashkit/CMakeLists.txt @@ -21,7 +21,7 @@ set(libhashkit_sources strerror.cc string.cc ) -add_library(libhashkit SHARED) +add_library(libhashkit) add_library(hashkit ALIAS libhashkit) set_target_properties(libhashkit PROPERTIES CXX_STANDARD ${CXX_STANDARD} diff --git a/src/libmemcached/CMakeLists.txt b/src/libmemcached/CMakeLists.txt index 81d84638..075a6308 100644 --- a/src/libmemcached/CMakeLists.txt +++ b/src/libmemcached/CMakeLists.txt @@ -85,7 +85,7 @@ if(W_NO_DEPRECATED_REGISTER) ) endif() -add_library(libmemcached SHARED) +add_library(libmemcached) add_library(memcached ALIAS libmemcached) set_target_properties(libmemcached PROPERTIES CXX_STANDARD ${CXX_STANDARD} diff --git a/src/libmemcachedprotocol/CMakeLists.txt b/src/libmemcachedprotocol/CMakeLists.txt index b28afe72..a32f264b 100644 --- a/src/libmemcachedprotocol/CMakeLists.txt +++ b/src/libmemcachedprotocol/CMakeLists.txt @@ -9,7 +9,7 @@ set(libmemcachedprotocol_sources pedantic.c ../libmemcached/byteorder.cc ) -add_library(libmemcachedprotocol SHARED) +add_library(libmemcachedprotocol) add_library(memcachedprotocol ALIAS libmemcachedprotocol) set_target_properties(libmemcachedprotocol PROPERTIES CXX_STANDARD ${CXX_STANDARD} diff --git a/src/libmemcachedutil/CMakeLists.txt b/src/libmemcachedutil/CMakeLists.txt index 78e87d30..400be003 100644 --- a/src/libmemcachedutil/CMakeLists.txt +++ b/src/libmemcachedutil/CMakeLists.txt @@ -6,7 +6,7 @@ set(libmemcachedutil_sources ping.cc version.cc ) -add_library(libmemcachedutil SHARED) +add_library(libmemcachedutil) add_library(memcachedutil ALIAS libmemcachedutil) if(CMAKE_USE_PTHREADS_INIT) target_sources(libmemcachedutil PRIVATE pool.cc) diff --git a/src/p9y/CMakeLists.txt b/src/p9y/CMakeLists.txt index 6906b8f0..67d84fde 100644 --- a/src/p9y/CMakeLists.txt +++ b/src/p9y/CMakeLists.txt @@ -20,6 +20,17 @@ target_include_directories(p9y PRIVATE ${CMAKE_BINARY_DIR}/include ) +install(TARGETS p9y EXPORT p9y-targets + RUNTIME COMPONENT bin DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE COMPONENT lib DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY COMPONENT lib DESTINATION ${CMAKE_INSTALL_LIBDIR} + ${TARGET_NAMELINK_COMPONENT} + ) +export(EXPORT p9y-targets NAMESPACE libmemcached::) +install(EXPORT p9y-targets NAMESPACE libmemcached:: + COMPONENT dev + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) + if(NOT HAVE_GETOPT_H) target_sources(p9y PRIVATE getopt.c) endif()