protocolbuffers / protobuf

Protocol Buffers - Google's data interchange format
http://protobuf.dev
Other
65.81k stars 15.51k forks source link

PkgConfig of protobuf not compatible with CMAKE_BUILD_TYPE=Debug #19325

Open andresailer opened 2 days ago

andresailer commented 2 days ago

What version of protobuf and what language are you using? Version: 5.25.4 Language: C++

What operating system (Linux, Windows, ...) and version?

Alma Linux 9

What runtime / compiler are you using (e.g., python version or gcc version) gcc13

What did you do? Steps to reproduce the behavior: Configured protobuf with

-D CMAKE_BUILD_TYPE=Debug

And then try linking another project that uses pkgconfig to find protobuf

What did you expect to see

A successfully linked package

What did you see instead?

linker cannot find -lprotobuf

The problem

CMake defines a postfix for debug builds

https://github.com/protocolbuffers/protobuf/blob/3ba07090485354a70a56a2d10b1f2ee5fd475163/CMakeLists.txt#L54-L55

But the pkgconfig template does not account for this possible postfix

https://github.com/protocolbuffers/protobuf/blob/3ba07090485354a70a56a2d10b1f2ee5fd475163/cmake/protobuf.pc.cmake#L10