Without this change, calling `find_package(gRPC REQUIRED)` errors out
with
CMake Error at /opt/homebrew/lib/cmake/grpc/gRPCConfig.cmake:8
(find_dependency):
Unknown CMake command "find_dependency".
The issue is that `find_dependency` is provided by the
`CMakeFindDependencyMacro` module[^1], so we need to `include` it before
use.
[^1]:
https://cmake.org/cmake/help/v3.26/module/CMakeFindDependencyMacro.html
Make it possible to specify your own protoc when building protobuf in
a submodule.
When cross-compiling, we need to build the protobuf libraries for the
target architecture, yet we need to use a protoc executable built for
the host architecture.
Remove some spaces at the end of lines. Change how variables are
referenced inside if() statements. Remove the space between if/endif
and the first parenthesis. Remove the duplicated condition from endif()
blocks. Make indentation more consistent. Remove unneeded duplicate
PRIVATE keywords from target_include_directories(). Remove redundant
set_source_files_properties() call, as the file is already GENERATED.