FS#59883 - [protobuf] Add Cmake files

Attached to Project: Arch Linux
Opened by greg (cheeseboy) - Thursday, 30 August 2018, 19:26 GMT
Last edited by Antonio Rojas (arojas) - Thursday, 07 July 2022, 14:06 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Lukas Fleischer (lfleischer)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Current package doesn't install the cmake files for protobuf.

File is here https://github.com/protocolbuffers/protobuf/blob/master/cmake/protobuf-config.cmake.in

Cmake has https://cmake.org/cmake/help/v3.9/module/FindProtobuf.html but it needs protobuf-config.cmake to be installed for it to work
This task depends upon

Closed by  Antonio Rojas (arojas)
Thursday, 07 July 2022, 14:06 GMT
Reason for closing:  Fixed
Additional comments about closing:  protobuf 21.2 includes cmake files
Comment by Eli Schwartz (eschwartz) - Thursday, 30 August 2018, 19:40 GMT
Sounds like an upstream issue, CMake should either provide their own *working* FindProtobuf module, or they should use the standard pkg-config files (but oh wait, cmake hates pkg-config and decided to reimplement it).

How should we install the cmake files? Currently we use the autotools build system to install protobuf...
Comment by greg (cheeseboy) - Thursday, 30 August 2018, 19:48 GMT
Just copy that file to correct dir using install and sed the things in the in file you need to set?
Comment by Eli Schwartz (eschwartz) - Thursday, 30 August 2018, 20:20 GMT
If they're just using configure_file...

Have you considered submitting an upstream bug report asking them to install the file when using autotools as well?
Comment by Antonio Rojas (arojas) - Thursday, 30 August 2018, 20:45 GMT
"it needs protobuf-config.cmake to be installed for it to work"

This doesn't make sense. Cmake uses *either* FindFoo.cmake files provided by cmake (or one of its extensions such as ECM) *or* FooConfig.cmake files provided by the packages themselves, but not both. And FWIW, find_package(Protobuf) works fine here with the cmake-provided module.
Comment by Jonathan Schilling (Jonathan9192) - Monday, 26 July 2021, 09:34 GMT
I stumbled across this when trying to build a basic gRPC/protobuf example (https://github.com/faaxm/exmpl-cmake-grpc).
AFAIK one would need to adjust the protobuf PKGBUILD to also generate the protobuf-config.cmake from protobuf-config.cmake.in ?

[edit] I make a prototype PKGBUILD to build protobuf using CMake. Maybe this could serve as a template?
https://gist.github.com/jonathanschilling/b4aac25486b5bf47a4a1ff4daec94379
Comment by m00n (m00n) - Friday, 01 July 2022, 23:35 GMT
@arojas Unfortunately, not the case for protobuf, apparently:

-- Found Protobuf: /usr/lib/libprotobuf.so (found version "3.21.1")
CMake Error at CMakeLists.txt:58 (find_package):
Could not find a package configuration file provided by "protobuf" with any
of the following names:

protobufConfig.cmake
protobuf-config.cmake

Add the installation prefix of "protobuf" to CMAKE_PREFIX_PATH or set
"protobuf_DIR" to a directory containing one of the above files. If
"protobuf" provides a separate development package or SDK, be sure it has
been installed.
Comment by Antonio Rojas (arojas) - Saturday, 02 July 2022, 07:13 GMT
@m00n what are you trying to build? cmake is case-sensitive, it's find_package(Protobuf), not find_package(protobuf)
Comment by m00n (m00n) - Thursday, 07 July 2022, 13:51 GMT
I wasn't the one to write the cmake file, but it does look like this works (It was `find_package(protobuf CONFIG REQUIRED)`, and i changed it to `find_package(Protobuf)`)

Loading...