PkgConfig: account for possible debug postfix in library name (#19444)

PkgConfig: account for possible debug postfix in library name, this fixes #19325

Closes #19444

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/19444 from andresailer:pkgConfigD 8f353cb6ca
PiperOrigin-RevId: 702547617
pull/19511/head
Andre Sailer 3 months ago committed by Copybara-Service
parent bedda1d424
commit 3b389187ce
  1. 4
      cmake/install.cmake
  2. 2
      cmake/protobuf.pc.cmake

@ -20,6 +20,10 @@ if (protobuf_BUILD_SHARED_LIBS)
set(_protobuf_PC_CFLAGS -DPROTOBUF_USE_DLLS) set(_protobuf_PC_CFLAGS -DPROTOBUF_USE_DLLS)
endif () endif ()
if(CMAKE_BUILD_TYPE STREQUAL Debug)
# attach debug postfix only in debug mode
set(protobuf_LIBRARY_POSTFIX ${protobuf_DEBUG_POSTFIX})
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf.pc.cmake configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc @ONLY) ${CMAKE_CURRENT_BINARY_DIR}/protobuf.pc @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf-lite.pc.cmake configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf-lite.pc.cmake

@ -7,6 +7,6 @@ Name: Protocol Buffers
Description: Google's Data Interchange Format Description: Google's Data Interchange Format
Version: @protobuf_VERSION@ Version: @protobuf_VERSION@
Requires: @_protobuf_PC_REQUIRES@ Requires: @_protobuf_PC_REQUIRES@
Libs: -L${libdir} -lprotobuf @CMAKE_THREAD_LIBS_INIT@ Libs: -L${libdir} -lprotobuf@protobuf_LIBRARY_POSTFIX@ @CMAKE_THREAD_LIBS_INIT@
Cflags: -I${includedir} @_protobuf_PC_CFLAGS@ Cflags: -I${includedir} @_protobuf_PC_CFLAGS@
Conflicts: protobuf-lite Conflicts: protobuf-lite

Loading…
Cancel
Save