From d180295a76d7e43b357765a8a6434fdf5f7d3abd Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 14 Dec 2020 17:38:56 +0100 Subject: [PATCH] cmake: compat with <3.12 --- CMake/_Include.cmake | 2 ++ CMakeConfig.txt | 16 ++++++---------- CMakeLists.txt | 4 +++- src/libhashkit/CMakeLists.txt | 2 +- src/libmemcached/CMakeLists.txt | 2 +- src/libmemcachedprotocol/CMakeLists.txt | 2 +- src/libmemcachedutil/CMakeLists.txt | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CMake/_Include.cmake b/CMake/_Include.cmake index 39442dc2..90ebc261 100644 --- a/CMake/_Include.cmake +++ b/CMake/_Include.cmake @@ -1,3 +1,5 @@ +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake") + include(_Configure) configure_init(${CMAKE_BINARY_DIR}/mem_config.h) diff --git a/CMakeConfig.txt b/CMakeConfig.txt index 377c03ad..5203ddac 100644 --- a/CMakeConfig.txt +++ b/CMakeConfig.txt @@ -17,6 +17,12 @@ elseif(UNIX) CACHE STRING "set relative rpath") endif() +if(${CMAKE_VERSION} VERSION_LESS "3.12") + set(TARGET_NAMELINK_COMPONENT "") +else() + set(TARGET_NAMELINK_COMPONENT NAMELINK_COMPONENT dev) +endif() + option(BUILD_TESTING "whether to enable build of the test suite" $ENV{BUILD_TESTING}) option(BUILD_DOCSONLY "build *only* documentation" @@ -79,13 +85,3 @@ if(BUILD_DOCS) set(SPHINX_CONF_APPEND "" CACHE STRING "append verbatim code to sphinx' conf.py") endif() - -# modules - -include(GNUInstallDirs) - -list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake") - -if(NOT BUILD_DOCSONLY) - include(CMake/_Include.cmake) -endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index c32fedae..48fc3298 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,21 +8,23 @@ include(CMakeVersions.txt) project(libmemcached VERSION "${LIBMEMCACHED_VERSION}" - HOMEPAGE_URL "https://github.com/m6w6/libmemcached" DESCRIPTION "libmemcached, a C/C++ memcached client library" ) +set(CMAKE_PROJECT_HOMEPAGE_URL "https://github.com/m6w6/libmemcached") set(PROJECT_CONTACT "Michael Wallner ") set(CXX_STANDARD 11) set(CMAKE_POSITION_INDEPENDENT_CODE ON) include(CMakeConfig.txt) +include(GNUInstallDirs) if(BUILD_DOCS OR BUILD_DOCSONLY) add_subdirectory(docs) endif() if(NOT BUILD_DOCSONLY) + include(CMake/_Include.cmake) set(CLIENTS memcapable diff --git a/src/libhashkit/CMakeLists.txt b/src/libhashkit/CMakeLists.txt index 06b0c315..1a03de23 100644 --- a/src/libhashkit/CMakeLists.txt +++ b/src/libhashkit/CMakeLists.txt @@ -42,7 +42,7 @@ configure_file(hashkitcon.h.in hashkitcon.h @ONLY) install(TARGETS libhashkit EXPORT libhashkit-targets LIBRARY COMPONENT lib - NAMELINK_COMPONENT dev + ${TARGET_NAMELINK_COMPONENT} DESTINATION ${CMAKE_INSTALL_LIBDIR}) export(EXPORT libhashkit-targets NAMESPACE libmemcached::) install(EXPORT libhashkit-targets NAMESPACE libmemcached:: diff --git a/src/libmemcached/CMakeLists.txt b/src/libmemcached/CMakeLists.txt index c3d53893..a6de76b7 100644 --- a/src/libmemcached/CMakeLists.txt +++ b/src/libmemcached/CMakeLists.txt @@ -122,7 +122,7 @@ enable_dtrace_for(libmemcached libmemcached_probes.d dtrace_probes.h) install(TARGETS libmemcached EXPORT libmemcached-targets LIBRARY COMPONENT lib - NAMELINK_COMPONENT dev + ${TARGET_NAMELINK_COMPONENT} DESTINATION ${CMAKE_INSTALL_LIBDIR}) export(EXPORT libmemcached-targets NAMESPACE libmemcached::) install(EXPORT libmemcached-targets NAMESPACE libmemcached:: diff --git a/src/libmemcachedprotocol/CMakeLists.txt b/src/libmemcachedprotocol/CMakeLists.txt index fc031565..2add5133 100644 --- a/src/libmemcachedprotocol/CMakeLists.txt +++ b/src/libmemcachedprotocol/CMakeLists.txt @@ -38,7 +38,7 @@ target_include_directories(libmemcachedprotocol PUBLIC install(TARGETS libmemcachedprotocol EXPORT libmemcachedprotocol-targets LIBRARY COMPONENT lib - NAMELINK_COMPONENT dev + ${TARGET_NAMELINK_COMPONENT} DESTINATION ${CMAKE_INSTALL_LIBDIR}) export(EXPORT libmemcachedprotocol-targets NAMESPACE libmemcached::) install(EXPORT libmemcachedprotocol-targets NAMESPACE libmemcached:: diff --git a/src/libmemcachedutil/CMakeLists.txt b/src/libmemcachedutil/CMakeLists.txt index af2562cd..f1b33fb6 100644 --- a/src/libmemcachedutil/CMakeLists.txt +++ b/src/libmemcachedutil/CMakeLists.txt @@ -43,7 +43,7 @@ target_include_directories(libmemcachedutil PUBLIC install(TARGETS libmemcachedutil EXPORT libmemcachedutil-targets LIBRARY COMPONENT lib - NAMELINK_COMPONENT dev + ${TARGET_NAMELINK_COMPONENT} DESTINATION ${CMAKE_INSTALL_LIBDIR}) export(EXPORT libmemcachedutil-targets NAMESPACE libmemcached::) install(EXPORT libmemcachedutil-targets NAMESPACE libmemcached:: -- 2.30.2