CMake: Allow build system to provide protobuf compiler #703
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Referenced issues
This ports the relevant CMake patches from libp2p/cpp-libp2p#59 over to kagome,
Not sure if the license is compatible and it might be required that @eigendude signs the CLA as this is his patch, just applied to a different code base.
Description of the Change
When building without Hunter, it is desirable to pass the path to protoc and
the protobuf include directory from the build system. Allow these variables
to be overridden.
Fixes the error:
| CMake Error at cmake/functions.cmake:52 (message):
| Protobuf_PROTOC_EXECUTABLE is empty
| Call Stack (most recent call first):
| cmake/functions.cmake:96 (compile_proto_to_cpp)
| src/crypto/protobuf/CMakeLists.txt:6 (add_proto_library)
Benefits
Support building kagome without hunter.
Possible Drawbacks
None
Alternate Designs
The alternative would be to not use custom functions at all but to use the functions provided by CMake or the protobuffer CMake pacakge config to compile any
.protofiles. I have a patch for this as well, but it is far more intrusive.