I have a small project in the works that requires the use of two libraries, namely ASIO (standalone) and nlohmann/json.
Adding the json library to my CMake project is pretty straight-forward:
include(FetchContent)
FetchContent_Declare(json
GIT_REPOSITORY https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent
GIT_TAG v3.9.1)
FetchContent_GetProperties(json)
if(NOT json_POPULATED)
FetchContent_Populate(json)
add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
target_link_libraries(foo PRIVATE nlohmann_json::nlohmann_json)
However, since ASIO doesn't have a CMakeLists.txt, it doesn't seem to work. Is there a workaround for this or do I absolutely need to install ASIO externally?
Probably worth mentioning that both libraries are header-only, so I only really need cmake to fetch the library and add the appropriate include paths.