FindProtobuf: Providing a PATHS hint to find_package(protobuf) causes a failure to find the package elsewhere
On platforms where protobuffers is available from the system I locate it using:
find_package(Protobuf 3.3.0 REQUIRED)
I installed protobuffer 3.5.0 to /opt/protobuf-3.5.0 on CentOS7 which provides only 2.5 which is too old for my use. CMake 3.18 is able to locate this if I provide a PATH hint as in:
find_package(Protobuf 3.3.0 REQUIRED PATHS /opt/protobuf-3.5.0)
However on other platforms (at least Debian9 and CentOS8) the addition of the hint prevents the package being location as follows:
Could not find a package configuration file provided by "Protobuf" (requested version 3.3.0) with any of the following names:
ProtobufConfig.cmake
protobuf-config.cmake
The same error occurs if "HINTS" is used in place of "PATHS".
This error message is misleading as on the other Linux platforms I use Debian9 and CentOS8. Protobuffers does not provide cmake configuration files at all, only pkg-config files. I believe the cmake based build is primarily intended for Windows though it does work for Linux (I use it for CentOS7).
It is my understanding (from https://cmake.org/cmake/help/latest/command/find_package.html) that PATHS and HINTS are just hints to find_package. Adding a hint that is incorrect for the current platform should not prevent a package being found elsewhere. I believe that behaviour is correct for other packages and suspect there is an issue with the FindProtobuf module itself.