[CMake] Simplify cross compilation of C++ projects with proto files
#14 492 ouverte le 20 oct. 2023
Métriques du dépôt
- Stars
- (71 223 stars)
- Métriques de merge PR
- (Merge moyen 2j 11h) (185 PRs mergées en 30 j)
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