build/cmake: improve msgpack lookup logic

This commit is contained in:
Adrien Béraud committed 2025-08-24 01:47:50 -04:00
1 parent 0fd642f92d
commit 57587b6cd8
1 file changed
+6 -6
+6 -6
View File
@@ -212,11 +212,11 @@ if (NOT MSVC)
# msgpack
check_include_file_cxx(msgpack.hpp HAVE_MSGPACKCXX)
if (NOT HAVE_MSGPACKCXX)
find_package(msgpack QUIET CONFIG NAMES msgpack msgpackc-cxx)
find_package(msgpack CONFIG NAMES msgpack-cxx)
if (NOT msgpack_FOUND)
find_package(msgpack QUIET CONFIG NAMES msgpack-cxx)
find_package(msgpack CONFIG NAMES msgpack msgpackc-cxx)
if (msgpack_FOUND)
set(MSGPACK_TARGET "msgpack-cxx")
set(MSGPACK_TARGET "msgpackc-cxx")
else()
if(OPENDHT_DOWNLOAD_DEPS)
# Workaround for msgpack-cxx
@@ -227,14 +227,14 @@ if (NOT MSVC)
)
set(MSGPACK_USE_BOOST OFF CACHE INTERNAL "Workaround for Boost")
FetchContent_MakeAvailable(msgpack-c)
find_package(msgpack-c CONFIG REQUIRED)
include_directories(${MSGPACK_INCLUDEDIR} ${msgpack-c_SOURCE_DIR}/include)
find_package(msgpack-cxx CONFIG REQUIRED)
set(MSGPACK_TARGET msgpack-cxx)
else()
message(SEND_ERROR "msgpack not found and the fallback downloader is not set! Please install msgpack or use OPENDHT_DOWNLOAD_DEPS option")
endif()
endif ()
else()
set(MSGPACK_TARGET "msgpackc-cxx")
set(MSGPACK_TARGET "msgpack-cxx")
endif()
endif()
# llhttp