fix #120: pkg-config 'Requires:' missing libsasl2
authorMichael Wallner <mike@php.net>
Thu, 9 Sep 2021 09:16:05 +0000 (11:16 +0200)
committerMichael Wallner <mike@php.net>
Thu, 9 Sep 2021 09:16:05 +0000 (11:16 +0200)
CMake/_Include.cmake
src/libhashkit/CMakeLists.txt
support/CMakeLists.txt
support/libmemcached.pc.in

index a5a98710aaf31f3a3d21a71ef1015ce9e408ac6d..22f99a8c193e1d73d7aeb6872de1f30b3555c607 100644 (file)
@@ -100,12 +100,21 @@ include(CheckThreads)
 include(CheckVisibility)
 include(InstallPublicHeaders)
 
+function(pkgconfig_export VAR VAL)
+    get_property(PREV GLOBAL PROPERTY PKGCONFIG_${VAR})
+    set_property(GLOBAL PROPERTY PKGCONFIG_${VAR} "${PREV} ${VAL}")
+endfunction()
+macro(pkgconfig_import VAR)
+    get_property(PKGCONFIG_${VAR} GLOBAL PROPERTY PKGCONFIG_${VAR})
+endmacro()
+
 ## sasl
 configure_define_01(LIBMEMCACHED_WITH_SASL_SUPPORT)
 if(ENABLE_SASL)
     check_dependency(LIBSASL sasl2)
     if(HAVE_LIBSASL)
         set(LIBMEMCACHED_WITH_SASL_SUPPORT 1)
+        pkgconfig_export(REQUIRES libsasl2)
     endif()
 endif()
 
index ed3f7f1d77caf79d7db960a07239ba735b7badf2..b820d27bafb0fd703c1fcd4eebc1a1ca3ecc9b79 100644 (file)
@@ -46,6 +46,7 @@ if(ENABLE_OPENSSL_CRYPTO)
                 if(OPENSSL_CRYPTO_LIBRARY)
                         target_compile_definitions(libhashkit PRIVATE HAVE_OPENSSL_CRYPTO)
                         target_link_libraries(libhashkit PUBLIC OpenSSL::Crypto)
+                        pkgconfig_export(REQUIRES_PRIVATE libcrypto)
                 else()
                         message(WARNING "Could not find OpenSSL::Crypto")
                 endif()
index 306168afe056569a65d2cf9cd4698b039862d488..16eb9c00d4b640374ed75e58dc80d87c686a9ab7 100644 (file)
@@ -10,6 +10,8 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/example.cnf
         DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}
         )
 
+pkgconfig_import(REQUIRES)
+pkgconfig_import(REQUIRES_PRIVATE)
 configure_file(libmemcached.pc.in libmemcached.pc @ONLY)
 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libmemcached.pc
         COMPONENT dev
index ef8ce60ba0d995b59eef792a9e5deb05e70f415d..f332c12e8f935b3b9fcb214b29843113623b7a50 100644 (file)
@@ -9,3 +9,5 @@ Description: libmemcached C/C++ library
 Version: @PROJECT_VERSION@
 Libs: -L@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ -lmemcached -lmemcachedutil
 Cflags: -I@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@
+Requires: @PKGCONFIG_REQUIRES@
+Requires.private: @PKGCONFIG_REQUIRES_PRIVATE@