protocolbuffers / protocolbuffers/protobuf
[CMake] Simplify cross compilation of C++ projects with proto files
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 72k
- Forks
- 16.3k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 140
Description
What language does this apply to?
C++ codegen
Describe the problem you are trying to solve.
When cross compiling a C++ project that makes use of the Protobuf-Config.cmake file to resolve the dependency the build for the target platform is found. For linking to libprotobuf.so this is correct, but the protoc compiler in that package can't be executed during build.
This situation requires workarounds in the client projects, for example grpc's cmake scaffold has the -D_gRPC_PROTOBUF_PROTOC_EXECUTABLE option to pass in the appropriate executable.
Describe the solution you'd like
Alter the CMake installation setup so that something like find_package(protoc) exports protoc only. I think the installed protobuf-*.cmake files can still export both if you want to preserve backwards compatibility.
Describe alternatives you've considered
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the installed Protobuf-Config.cmake and protobuf-*.cmake files, then compare their behavior with the grpc CMake scaffold and its -D_gRPC_PROTOBUF_PROTOC_EXECUTABLE workaround. Done means a cross-compiled C++ project can resolve the target library while using an executable protoc without client-specific overrides, while preserving the stated backwards compatibility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100