feat: About dialog with version, commit, build time and settings path
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
82f91d00c0
commit
a0fa845b58
8 files changed
+170
-9
No files matched your search
@@ -0,0 +1,38 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
# Writes ${OUT} with the three strings src/build_info.hpp declares. Run both at
|
||||
# configure time (so the file exists when add_executable names it) and on every
|
||||
# build (so the commit and the timestamp are the ones that produced the binary).
|
||||
#
|
||||
# Expects: SRC (the source tree), OUT (the .cpp to write), VERSION.
|
||||
|
||||
set(COMMIT "unknown")
|
||||
find_package(Git QUIET)
|
||||
if(GIT_FOUND AND EXISTS "${SRC}/.git")
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} describe --always --dirty
|
||||
WORKING_DIRECTORY "${SRC}"
|
||||
OUTPUT_VARIABLE GIT_OUT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
RESULT_VARIABLE GIT_RC)
|
||||
if(GIT_RC EQUAL 0 AND NOT GIT_OUT STREQUAL "")
|
||||
set(COMMIT "${GIT_OUT}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(TIMESTAMP STAMP "%Y-%m-%d %H:%M UTC" UTC)
|
||||
|
||||
file(WRITE "${OUT}"
|
||||
"// SPDX-License-Identifier: MIT
|
||||
// Generated by cmake/write_build_info.cmake. Do not edit, do not commit.
|
||||
#include \"build_info.hpp\"
|
||||
|
||||
namespace udpscope::build_info {
|
||||
|
||||
const char* const kVersion = \"${VERSION}\";
|
||||
const char* const kCommit = \"${COMMIT}\";
|
||||
const char* const kTimestamp = \"${STAMP}\";
|
||||
|
||||
} // namespace udpscope::build_info
|
||||
")
|
||||
Reference in new issue
Block a user