Add version.hpp.in and display it on '--version' flag
Reviewers: mferencevic, buda, mislav.bradac Reviewed By: mislav.bradac Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D831
This commit is contained in:
parent
eb821aa615
commit
8c9ff2d79a
@ -81,6 +81,11 @@ set(libs_dir ${CMAKE_SOURCE_DIR}/libs)
|
||||
set(tests_dir ${CMAKE_SOURCE_DIR}/tests)
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# Generate a version.hpp file
|
||||
set(VERSION_STRING ${${project_name}_VERSION})
|
||||
configure_file(${src_dir}/version.hpp.in include/version.hpp @ONLY)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
||||
|
||||
# build flags -----------------------------------------------------------------
|
||||
# release flags
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "utils/sysinfo/memory.hpp"
|
||||
#include "utils/terminate_handler.hpp"
|
||||
|
||||
#include "version.hpp"
|
||||
|
||||
namespace fs = std::experimental::filesystem;
|
||||
using endpoint_t = io::network::NetworkEndpoint;
|
||||
using socket_t = io::network::Socket;
|
||||
@ -92,6 +94,7 @@ void load_config(int &argc, char **&argv) {
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
fs::current_path(fs::path(argv[0]).parent_path());
|
||||
gflags::SetVersionString(version_string);
|
||||
load_config(argc, argv);
|
||||
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
|
3
src/version.hpp.in
Normal file
3
src/version.hpp.in
Normal file
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
static const char *version_string = "@VERSION_STRING@";
|
Loading…
Reference in New Issue
Block a user