Files
mtusi2026lab5/cmake/ImportMinioDeps.cmake
2026-11-16 09:28:38 +03:00

56 lines
2.3 KiB
CMake

# Provide the imported target names expected by minio-cpp's CMakeLists
# (unofficial-curlpp / unofficial-inih) using system packages from apt.
find_package(OpenSSL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(CURL REQUIRED)
# nlohmann_json (header-only; Ubuntu ships /usr/include/nlohmann/json.hpp)
if(NOT TARGET nlohmann_json::nlohmann_json)
find_package(nlohmann_json QUIET CONFIG)
endif()
if(NOT TARGET nlohmann_json::nlohmann_json)
add_library(nlohmann_json INTERFACE)
add_library(nlohmann_json::nlohmann_json ALIAS nlohmann_json)
find_path(NLOHMANN_JSON_INCLUDE_DIR nlohmann/json.hpp)
if(NOT NLOHMANN_JSON_INCLUDE_DIR)
message(FATAL_ERROR "nlohmann/json.hpp not found (install nlohmann-json3-dev)")
endif()
target_include_directories(nlohmann_json INTERFACE "${NLOHMANN_JSON_INCLUDE_DIR}")
endif()
# pugixml
if(NOT TARGET pugixml)
find_package(pugixml QUIET CONFIG)
endif()
if(NOT TARGET pugixml AND NOT TARGET pugixml::pugixml)
pkg_check_modules(PUGIXML REQUIRED IMPORTED_TARGET pugixml)
add_library(pugixml INTERFACE)
target_link_libraries(pugixml INTERFACE PkgConfig::PUGIXML)
endif()
if(TARGET pugixml::pugixml AND NOT TARGET pugixml)
add_library(pugixml ALIAS pugixml::pugixml)
endif()
# curlpp → unofficial::curlpp::curlpp
if(NOT TARGET unofficial::curlpp::curlpp)
find_library(CURLPP_LIBRARY NAMES curlpp REQUIRED)
find_path(CURLPP_INCLUDE_DIR curlpp/cURLpp.hpp REQUIRED)
add_library(unofficial_curlpp INTERFACE)
target_include_directories(unofficial_curlpp INTERFACE "${CURLPP_INCLUDE_DIR}")
target_link_libraries(unofficial_curlpp INTERFACE "${CURLPP_LIBRARY}" CURL::libcurl)
add_library(unofficial::curlpp::curlpp ALIAS unofficial_curlpp)
endif()
# inih INIReader → unofficial::inih::inireader
if(NOT TARGET unofficial::inih::inireader)
find_library(INIREADER_LIBRARY NAMES INIReader REQUIRED)
find_library(INIH_LIBRARY NAMES inih REQUIRED)
find_path(INIREADER_INCLUDE_DIR INIReader.h REQUIRED)
add_library(unofficial_inih_inireader INTERFACE)
target_include_directories(unofficial_inih_inireader INTERFACE "${INIREADER_INCLUDE_DIR}")
target_link_libraries(unofficial_inih_inireader INTERFACE
"${INIREADER_LIBRARY}" "${INIH_LIBRARY}")
add_library(unofficial::inih::inireader ALIAS unofficial_inih_inireader)
endif()