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