diff --git a/userspace/libscap/libscap.pc.in b/userspace/libscap/libscap.pc.in index c5948489fe..829bcd19b7 100644 --- a/userspace/libscap/libscap.pc.in +++ b/userspace/libscap/libscap.pc.in @@ -1,4 +1,4 @@ -prefix=${pcfiledir}/../.. +prefix=@CMAKE_INSTALL_PREFIX@ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @@ -6,5 +6,6 @@ Name: libscap Description: lib for System CAPture Version: @FALCOSECURITY_LIBS_VERSION@ -Libs: -L${libdir} @LIBSCAP_LINK_LIBDIRS_FLAGS@ @LIBSCAP_LINK_LIBRARIES_FLAGS@ +Requires: zlib +Libs: -L${libdir} -L{libdir}/@LIBS_PACKAGE_NAME@/libscap @LIBSCAP_LINK_LIBDIRS_FLAGS@ @LIBSCAP_LINK_LIBRARIES_FLAGS@ Cflags: -I${includedir}/@LIBS_PACKAGE_NAME@/libscap -I${includedir}/@LIBS_PACKAGE_NAME@/driver -I${includedir}/@LIBS_PACKAGE_NAME@ -I@UTHASH_INCLUDE@ diff --git a/userspace/libsinsp/CMakeLists.txt b/userspace/libsinsp/CMakeLists.txt index 5d9ebacd9b..4d31931130 100644 --- a/userspace/libsinsp/CMakeLists.txt +++ b/userspace/libsinsp/CMakeLists.txt @@ -169,13 +169,9 @@ target_link_libraries(sinsp "${RE2_LIB}" ) -set(SINSP_PKGCONFIG_LIBRARIES - scap - "${ZLIB_LIB}" - "${CURL_LIBRARIES}" - "${JSONCPP_LIB}" - "${RE2_LIB}" -) +set(SINSP_PKGCONFIG_LIBRARIES) +set(SINSP_PKGCONFIG_REQUIRES jsoncpp) +set(SINSP_PKGCONFIG_REQUIRES_PRIVATE libcurl re2) if(NOT EMSCRIPTEN) target_link_libraries(sinsp @@ -184,7 +180,8 @@ if(NOT EMSCRIPTEN) PRIVATE "${TBB_LIB}" ) - list(APPEND SINSP_PKGCONFIG_LIBRARIES "${CARES_LIB}") + list(APPEND SINSP_PKGCONFIG_REQUIRES libcares) + list(APPEND SINSP_PKGCONFIG_REQUIRES_PRIVATE tbb) endif() if(USE_BUNDLED_VALIJSON) @@ -248,14 +245,12 @@ if(NOT WIN32) "${PROTOBUF_LIB}" "${CARES_LIB}" ) - list(APPEND SINSP_PKGCONFIG_LIBRARIES - "${GRPC_LIBRARIES}" - "${GRPCPP_LIB}" - "${GRPC_LIB}" - "${GPR_LIB}" - "${PROTOBUF_LIB}" - "${CARES_LIB}" - ) + list(APPEND SINSP_PKGCONFIG_REQUIRES + gpr + grpc + grpc++ + protobuf + libcares) if(NOT MUSL_OPTIMIZED_BUILD) target_link_libraries(sinsp INTERFACE rt anl) @@ -269,7 +264,7 @@ if(NOT WIN32) endif() # NOT APPLE target_link_libraries(sinsp INTERFACE "${OPENSSL_LIBRARIES}") - list(APPEND SINSP_PKGCONFIG_LIBRARIES "${OPENSSL_LIBRARIES}") + list(APPEND SINSP_PKGCONFIG_REQUIRES libcrypto libssl) target_link_libraries(sinsp INTERFACE dl pthread) list(APPEND SINSP_PKGCONFIG_LIBRARIES dl pthread) @@ -306,41 +301,17 @@ if(NOT DEFINED SINSP_AGENT_CGROUP_MEM_PATH_ENV_VAR) endif() add_definitions(-DSINSP_AGENT_CGROUP_MEM_PATH_ENV_VAR="${SINSP_AGENT_CGROUP_MEM_PATH_ENV_VAR}") -# Build our pkg-config "Libs:" flags. For now, loop over SINSP_PKGCONFIG_LIBRARIES. If -# we ever start using pkg_search_module or pkg_check_modules in cmake/modules -# we could add each module to our "Requires:" line instead. We might need to -# expand this to use some of the techniques in -# https://github.com/curl/curl/blob/curl-7_84_0/CMakeLists.txt#L1539 -set(SINSP_PKG_CONFIG_LIBS) -set(SINSP_PKG_CONFIG_LIBDIRS "") -foreach(sinsp_lib ${SINSP_PKGCONFIG_LIBRARIES}) - if(${sinsp_lib} MATCHES "^-") - # We have a flag. Pass it through unchanged. - list(APPEND SINSP_PKG_CONFIG_LIBS ${sinsp_lib}) - elseif(${sinsp_lib} MATCHES "/") - # We have a path. Convert it to -L