Skip to content
Takatoshi Kondo edited this page Jul 13, 2023 · 2 revisions

cmake

How to support both msgpack-c (C++) version 5.x and 6.x ?

Since version 6.0.0, the package name is updated to msgpack-cxx. See https://github.com/msgpack/msgpack-c/releases/tag/cpp-6.0.0

If you want to suppport both 5.x and 6.x, you can write your CMakeLists.txt as follows:

find_package(msgpackc-cxx QUIET CONFIG NAMES msgpackc-cxx msgpack)
if(msgpackc-cxx_FOUND)
  add_library(msgpack-cxx ALIAS msgpackc-cxx)
else()
  find_package(msgpack-cxx CONFIG REQUIRED)
endif()

See also #1079