From 30c68d029dd6f1e841dd61c1cf541d6fafd67a20 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sat, 18 Jul 2020 07:00:57 +0100 Subject: [PATCH] cmake: pkgconfig: make sure to list platform libs https://github.com/warmcat/libwebsockets/issues/1975 --- lib/CMakeLists.txt | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 6ed6b50e8..7392f68a7 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -258,6 +258,18 @@ set(CPACK_COMPONENT_DEV_DISPLAY_NAME "Development files" PARENT_SCOPE) if (UNIX) +# figure out pkfcfg required libs here + +set(lws_requires "") +if (LWS_HAVE_LIBCAP) + if (NOT lws_requires STREQUAL "") + set(lws_requires "${lws_requires},libpcap") + else() + set(lws_requires "libpcap") + endif() +endif() + + # Generate and install pkgconfig. # (This is not indented, because the tabs will be part of the output) file(WRITE "${PROJECT_BINARY_DIR}/libwebsockets.pc" @@ -271,8 +283,13 @@ Description: Websockets server and client library Version: ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH} Libs: -L\${libdir} -lwebsockets -Cflags: -I\${includedir}" +Cflags: -I\${includedir} +" ) +if (NOT ${lws_requires} STREQUAL "") + file(APPEND "${PROJECT_BINARY_DIR}/libwebsockets.pc" "Requires: ${lws_requires}") +endif() + install(FILES "${PROJECT_BINARY_DIR}/libwebsockets.pc" DESTINATION lib${LIB_SUFFIX}/pkgconfig) @@ -289,9 +306,15 @@ Version: ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_P Libs: -L\${libdir} -lwebsockets_static Libs.private: -Cflags: -I\${includedir}" +Cflags: -I\${includedir} +" ) +if (NOT ${lws_requires} STREQUAL "") + file(APPEND "${PROJECT_BINARY_DIR}/libwebsockets_static.pc" "Requires: ${lws_requires}") +endif() + + install(FILES "${PROJECT_BINARY_DIR}/libwebsockets_static.pc" DESTINATION lib${LIB_SUFFIX}/pkgconfig)