CMakeLists.txt 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. find_package(OpenSSL REQUIRED)
  2. # LMDB — needed by the offline sub-db audit/repair commands, which operate
  3. # directly on an env on disk rather than through the gRPC API.
  4. if(NOT LMDB_INCLUDE_DIR OR NOT LMDB_LIBRARY)
  5. find_path(LMDB_INCLUDE_DIR lmdb.h)
  6. find_library(LMDB_LIBRARY NAMES lmdb)
  7. if(NOT LMDB_INCLUDE_DIR OR NOT LMDB_LIBRARY)
  8. message(FATAL_ERROR "LMDB not found. Install liblmdb-dev.")
  9. endif()
  10. endif()
  11. add_executable(smartbotic-db-cli main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../service/src/storage/subdb_placement.cpp)
  12. target_include_directories(smartbotic-db-cli PRIVATE
  13. ${CMAKE_CURRENT_SOURCE_DIR}/../service/src
  14. ${LMDB_INCLUDE_DIR}
  15. )
  16. target_link_libraries(smartbotic-db-cli PRIVATE
  17. smartbotic-db-client
  18. OpenSSL::SSL
  19. OpenSSL::Crypto
  20. ${LMDB_LIBRARY}
  21. )
  22. # v2.11.1 — the CLI reports its own version and build commit, from the same
  23. # top-level VERSION file and BUILD_GIT_COMMIT the service uses. Before this
  24. # `--version` was not a flag at all: it fell through to command dispatch, which
  25. # tried to CONNECT to a server, so the one question you ask a binary before
  26. # trusting anything else it says needed a running database to answer.
  27. target_compile_definitions(smartbotic-db-cli PRIVATE
  28. SMARTBOTIC_DB_VERSION_STRING="${SMARTBOTIC_DB_VERSION}"
  29. SMARTBOTIC_DB_GIT_COMMIT_STRING="${SMARTBOTIC_DB_GIT_COMMIT}"
  30. )