# Generate a version.hpp file
set(VERSION_STRING ${memgraph_VERSION})
configure_file(../../src/version.hpp.in version.hpp @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

# Memgraph Client Target
add_executable(mg_client mg_client/main.cpp)
set(CLIENT_LIBS mg-communication mg-io mg-utils)
if (READLINE_FOUND)
  list(APPEND CLIENT_LIBS readline)
endif()
target_link_libraries(mg_client ${CLIENT_LIBS})

# Memgraph Dump Target
add_executable(mg_dump mg_dump/main.cpp)
target_include_directories(mg_dump PRIVATE ${MGCLIENT_INCLUDE_DIR})
target_link_libraries(mg_dump fmt gflags glog mgclient pthread)

# Strip the executable in release build.
string(TOLOWER ${CMAKE_BUILD_TYPE} lower_build_type)
if (lower_build_type STREQUAL "release")
  add_custom_command(TARGET mg_client POST_BUILD
                     COMMAND strip -s mg_client
                     COMMENT "Stripping symbols and sections from mg_client")
endif()

install(TARGETS mg_client RUNTIME DESTINATION bin)

# Target for building all the tool executables.
add_custom_target(tools DEPENDS mg_client mg_dump)
