FindProtobuf: Try to avoid protobuf header - protoc incompatibilities
On some systems [1], a protoc
may be on the PATH
that is newer than the protobuf headers in /usr/include
.
That may lead to build failure.
Currently FindProtobuf.cmake warns upon this
https://gitlab.kitware.com/cmake/cmake/blob/db0b740f/Modules/FindProtobuf.cmake#L499-503
but does not have any strategy to find a matching version.
A naive strategy is to look for the library headers at ${Protobuf_PROTOC_EXECUTABLE}/../lib
if Protobuf_PROTOC_EXECUTABLE
is found.
[1]: For example for users of anaconda, who installed protobuf
via anaconda and manually put anaconda/bin
onto PATH
. For some reason, this was done by someone maintaining https://docs.aws.amazon.com/dlami/latest/devguide/overview-base.html
Edited by Brad King