You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So the versioning schemes in protobuf are a tad confusing, see eg https://protobuf.dev/support/version-support/#cpp
In the second table, a version like C++ version 5.26.x corresponds to protoc version 26.x.
But in a homebrew install, for example, brew info protobuf reports version 26.1, and using find_package(Protobuf CONFIG) with such an install sets Protobuf_VERSION to 26.1.0. But then include/google/protobuf/port_def.inc defines
#definePROTOBUF_VERSION5026001
corresponding to 5.26.1.
Now compare this to a conan project which requires and tool_requires, e.g., protobuf/5.27.0. The generated FindProtobuf.cmake sets set(Protobuf_VERSION "5.27.0"), but a conan create . with a CMake project which requires protobuf/5.27.0 prints
...
-- Conan: Including build module from '/Users/lia/.conan2/p/b/proto24456bb2a2261/p/lib/cmake/protobuf/protobuf-module.cmake'
and in this file protobuf-module.cmake, we have set(Protobuf_VERSION "27.0.0"), which is also what's reported from
Anyway long story short, is there a canonical way to extract what we might call the [lib]protoc version from the conan installation? I do think conan may be doing the more correct thing here, but I am dealing with some existing CMake code which expected to get a 20-something variable number like the one produced by homebrew. Some options I was considering would be
invoke protoc --version within CMake
construct a new version number from <minor>.<patch>.0 from the Protobuf_VERSION
somehow include the protobuf-module.cmake ?
some other option programatically within the conanfile.py ?
Any feedback/suggestions are appreciated!
The text was updated successfully, but these errors were encountered:
Hi @lia-viam thanks a lot for your question, sorry that this got no answer till now.
A current workaround that can be implemented in the consumer conanfile, is to set the system_package_version property in your cmakedeps for protobuf, something like:
This will modify the config version generated for protobuf as part of your build (Note that we have conan-io/conan#17504 that would add cmake_config_version as a property for this with a better naming)
Let me know if this can help, happy to help where possible :)
What is your question?
So the versioning schemes in protobuf are a tad confusing, see eg
https://protobuf.dev/support/version-support/#cpp
In the second table, a version like C++ version 5.26.x corresponds to protoc version 26.x.
But in a homebrew install, for example,
brew info protobuf
reports version26.1
, and usingfind_package(Protobuf CONFIG)
with such an install setsProtobuf_VERSION
to26.1.0
. But theninclude/google/protobuf/port_def.inc
definescorresponding to
5.26.1
.Now compare this to a
conan
project whichrequires
andtool_requires
, e.g.,protobuf/5.27.0
. The generatedFindProtobuf.cmake
setsset(Protobuf_VERSION "5.27.0")
, but aconan create .
with a CMake project which requiresprotobuf/5.27.0
printsand in this file
protobuf-module.cmake
, we haveset(Protobuf_VERSION "27.0.0")
, which is also what's reported from$ ~/.conan2/p/b/proto24456bb2a2261/p/bin/protoc --version libprotoc 27.0
Anyway long story short, is there a canonical way to extract what we might call the
[lib]protoc
version from the conan installation? I do think conan may be doing the more correct thing here, but I am dealing with some existing CMake code which expected to get a 20-something variable number like the one produced by homebrew. Some options I was considering would beprotoc --version
within CMake<minor>.<patch>.0
from theProtobuf_VERSION
protobuf-module.cmake
?conanfile.py
?Any feedback/suggestions are appreciated!
The text was updated successfully, but these errors were encountered: