cmake: pkgconfig: make sure to list platform libs
https://github.com/warmcat/libwebsockets/issues/1975
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 6ed6b50..7392f68 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -258,6 +258,18 @@
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 @@
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 @@
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)