FindPackages.cmake 963 B

12345678910111213141516171819202122232425262728293031323334
  1. # Find system packages
  2. # Required packages
  3. find_package(PkgConfig REQUIRED)
  4. find_package(Threads REQUIRED)
  5. find_package(OpenSSL REQUIRED)
  6. find_package(CURL REQUIRED)
  7. # nlohmann-json
  8. find_package(nlohmann_json 3.11 QUIET)
  9. if(NOT nlohmann_json_FOUND)
  10. pkg_check_modules(nlohmann_json REQUIRED IMPORTED_TARGET nlohmann_json)
  11. add_library(nlohmann_json::nlohmann_json ALIAS PkgConfig::nlohmann_json)
  12. endif()
  13. # spdlog
  14. find_package(spdlog QUIET)
  15. if(NOT spdlog_FOUND)
  16. pkg_check_modules(spdlog REQUIRED IMPORTED_TARGET spdlog)
  17. add_library(spdlog::spdlog ALIAS PkgConfig::spdlog)
  18. endif()
  19. # gRPC and Protobuf
  20. find_package(gRPC CONFIG QUIET)
  21. if(NOT gRPC_FOUND)
  22. pkg_check_modules(grpc++ REQUIRED IMPORTED_TARGET grpc++)
  23. add_library(gRPC::grpc++ ALIAS PkgConfig::grpc++)
  24. endif()
  25. find_package(Protobuf REQUIRED)
  26. # libwebsockets
  27. pkg_check_modules(websockets REQUIRED IMPORTED_TARGET libwebsockets)
  28. add_library(websockets ALIAS PkgConfig::websockets)