From 2f1aef272adb1b675662c4f76f9a711b0a83cae1 Mon Sep 17 00:00:00 2001 From: Adrien Beraud <adrien.beraud@savoirfairelinux.com> Date: Mon, 10 Apr 2023 11:12:51 -0400 Subject: [PATCH] msgpack: support more package names --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6860fd5a..e1030586 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,7 +61,13 @@ if (NOT MSVC) pkg_search_module (Nettle REQUIRED IMPORTED_TARGET nettle) check_include_file_cxx(msgpack.hpp HAVE_MSGPACKCXX) if (NOT HAVE_MSGPACKCXX) - find_package (msgpack REQUIRED CONFIG NAMES msgpackc-cxx msgpack msgpack-cxx) + find_package(msgpack QUIET CONFIG NAMES msgpack msgpackc-cxx) + if (NOT msgpack_FOUND) + find_package(msgpack REQUIRED CONFIG NAMES msgpack-cxx) + set(MSGPACK_TARGET "msgpack-cxx") + else() + set(MSGPACK_TARGET "msgpackc-cxx") + endif() endif() if (OPENDHT_TOOLS) find_package (Readline 6 REQUIRED) @@ -353,7 +359,7 @@ target_link_libraries(opendht ${FMT_LIBRARY} ) if (NOT HAVE_MSGPACKCXX) - target_link_libraries(opendht PUBLIC msgpackc-cxx) + target_link_libraries(opendht PUBLIC MSGPACK_TARGET) endif() if (Jsoncpp_FOUND) target_link_libraries(opendht PUBLIC PkgConfig::Jsoncpp) -- GitLab