From 2c55945fc55eddef4f38f5f43b2a7b0c9a45accf Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Thu, 20 Apr 2023 15:04:28 -0700 Subject: [PATCH] Fix declared dependencies for pkg-config --- cmake/install.cmake | 9 +++++++++ cmake/protobuf-lite.pc.cmake | 2 ++ cmake/protobuf.pc.cmake | 2 ++ 3 files changed, 13 insertions(+) diff --git a/cmake/install.cmake b/cmake/install.cmake index f7a0d9e177..af891ca0c3 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -1,5 +1,14 @@ include(GNUInstallDirs) +foreach(_target IN LISTS protobuf_ABSL_USED_TARGETS) + string(REPLACE :: _ _modified_target ${_target}) + list(APPEND _pc_targets ${_modified_target}) +endforeach() +list(APPEND _pc_targets "utf8_range") + +string(JOIN " " _pc_target_list ${_pc_targets}) +set(_protobuf_PC_REQUIRES ${_pc_target_list}) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf-lite.pc.cmake diff --git a/cmake/protobuf-lite.pc.cmake b/cmake/protobuf-lite.pc.cmake index 9745cb89c7..7f88046998 100644 --- a/cmake/protobuf-lite.pc.cmake +++ b/cmake/protobuf-lite.pc.cmake @@ -6,6 +6,8 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: Protocol Buffers Description: Google's Data Interchange Format Version: @protobuf_VERSION@ +Requires: @_protobuf_PC_REQUIRES@ +Requires.private: @_protobuf_PC_REQUIRES_PRIVATE@ Libs: -L${libdir} -lprotobuf-lite @CMAKE_THREAD_LIBS_INIT@ Cflags: -I${includedir} Conflicts: protobuf diff --git a/cmake/protobuf.pc.cmake b/cmake/protobuf.pc.cmake index f068e6926e..b3cda92075 100644 --- a/cmake/protobuf.pc.cmake +++ b/cmake/protobuf.pc.cmake @@ -6,6 +6,8 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: Protocol Buffers Description: Google's Data Interchange Format Version: @protobuf_VERSION@ +Requires: @_protobuf_PC_REQUIRES@ +Requires.private: @_protobuf_PC_REQUIRES_PRIVATE@ Libs: -L${libdir} -lprotobuf @CMAKE_THREAD_LIBS_INIT@ Cflags: -I${includedir} Conflicts: protobuf-lite