Skip to content

[CMake] Simplify cross compilation of C++ projects with proto files #14492

Open
@tobim

Description

@tobim

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions