Description
CMakeLists.txt
does currently not require a particular version in its calls to find_package(Protobuf)
, so if some version of that library is installed in the system, CMake configures happily but then compilation fails if an incompatible version is found. Those calls should, thus, ensure that only compatible versions are accepted.
One problem is that FindProtobuf.cmake
is broken (see this issue I just filed). If no suitable version is found, find_package
will report so but still create targets, such that the fall back of downloading a compatible version fails because the targets it wants to create already exist. The only way I see to fix this is force CONFIG
mode, which doesn't have that problem but, according to the comment, requires CMake version 3.27. (If we, instead, wait for FindProtobuf.cmake
to be fixed, we'd get that at the earliest in CMake version 3.31, so that would't make things better.)
Finally, we should decide which version of Protobuf we require, store that once in some global variable, and use that everywhere. I know for sure that version 3.21 is not enough because, since #126, we use ErrorCollector::RecordError
, which only exists since version 3.22. I am not sure, though, if that version fully works.