add depedencies to cxx/CMakeLists.txt (ASIO and spdlog)

This commit is contained in:
2025-02-05 17:56:02 +03:00
parent aefdf3912c
commit 407a805c30
2 changed files with 88 additions and 0 deletions

27
cmake/FindASIO.cmake Normal file
View File

@@ -0,0 +1,27 @@
#
# ASIO
#
set(ASIO_FOUND FALSE)
find_package(Threads REQUIRED)
find_path(ASIO_DIR asio.hpp HINTS ${ASIO_INSTALL_DIR} PATH_SUFFIXES include)
if (NOT ASIO_DIR)
message(WARNING "Cannot find ASIO library headers!")
set(ASIO_FOUND FALSE)
else()
message(STATUS "Found ASIO: TRUE (${ASIO_DIR})")
# ASIO is header-only library so it is IMPORTED target
add_library(ASIO::ASIO INTERFACE IMPORTED GLOBAL)
# set standalone version (do not use Boost)
set_target_properties(ASIO::ASIO PROPERTIES INTERFACE_COMPILE_DEFINITIONS "ASIO_STANDALONE" INTERFACE_INCLUDE_DIRECTORIES "${ASIO_DIR}")
target_link_libraries(ASIO::ASIO INTERFACE Threads::Threads)
set(ASIO_FOUND TRUE)
endif()