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
Hi,
What is the recommended way to detect and use msgpack-cxx with CMake that would work with msgpack 6.0.0 and also be backward-compatible with older versions ?
that depends on how you install msgpack-cxx, if you clone this project and use cmake to install it, then using find_package should work, similarly for Conan.
the problem is this library makes a breaking change in version v6.0.0, so for versions earlier than that, you’ll have to use msgpackc-cxx. In you CMake script, you can do something like
@uyha It seems that older versions of msgpack-c++ (like version 3.0 in Ubuntu 20.04 and version 3.3 in Ubuntu 22.04) use 'msgpack' instead of 'msgpack-cxx' or 'msgpackc-cxx' ?
Activity
uyha commentedon Jul 6, 2023
that depends on how you install msgpack-cxx, if you clone this project and use cmake to install it, then using
find_packageshould work, similarly for Conan.aberaud commentedon Jul 8, 2023
Thanks.
I currently use:
However this only works with the latest version 6.0.0.
What's the recommended way to include and link msgpack that would be backward compatible with older msgpack versions ? Thanks.
[-]Detect msgpack-cxx with cmake[/-][+]Detect msgpack-cxx <= 6.0.0 with cmake[/+]uyha commentedon Jul 8, 2023
the problem is this library makes a breaking change in version v6.0.0, so for versions earlier than that, you’ll have to use
msgpackc-cxx. In you CMake script, you can do something likeThen you can link your targets with
msgpack-cxxregardless of the version.uyha commentedon Jul 8, 2023
or if you just want to detect the whether the library is installed and use it, the following snippet may be useful.
aberaud commentedon Jul 8, 2023
Many thanks :)
Maybe this should be documented in the README because older versions will be around for a while.
uyha commentedon Jul 8, 2023
I’ll create a PR when i have time
aberaud commentedon Jul 12, 2023
@uyha It seems that older versions of msgpack-c++ (like version 3.0 in Ubuntu 20.04 and version 3.3 in Ubuntu 22.04) use 'msgpack' instead of 'msgpack-cxx' or 'msgpackc-cxx' ?
So there would be a need for a 3-level checks ?
Something like:
Does this makes sense ?
uyha commentedon Jul 12, 2023
looks fine for me
aberaud commentedon Jul 13, 2023
We ended up using:
redboltz commentedon Jul 13, 2023
I added the document about that in Wiki.
https://github.com/msgpack/msgpack-c/wiki/Q%26A#how-to-support-both-msgpack-c-c-version-5x-and-6x-
User can find the information using search box like this:
https://github.com/search?q=repo%3Amsgpack%2Fmsgpack-c+cmake&type=wikis