Skip to content

Commit

Permalink
add git commit hash to debug version string
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardAH committed Dec 10, 2021
1 parent fbedfb2 commit bb3fe25
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ endif ()

project (rippled)

# make GIT_COMMIT_HASH define available to all sources
find_package(Git)
if(Git_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=40
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE GIT_COMMIT_HASH)
message(STATUS gch: ${GIT_COMMIT_HASH})
add_definitions(-DGIT_COMMIT_HASH="${GIT_COMMIT_HASH}")
endif() #git

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Builds/CMake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Builds/CMake/deps")

Expand Down
3 changes: 3 additions & 0 deletions src/ripple/protocol/impl/BuildInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ char const* const versionString = "1.8.1"
// clang-format on

#if defined(DEBUG) || defined(SANITIZER)
#ifdef GIT_COMMIT_HASH
"-" GIT_COMMIT_HASH
#endif
"+"
#ifdef DEBUG
"DEBUG"
Expand Down

0 comments on commit bb3fe25

Please sign in to comment.