init repo.
This commit is contained in:
26
cmake/BuildInfo.cmake
Normal file
26
cmake/BuildInfo.cmake
Normal file
@ -0,0 +1,26 @@
|
||||
macro(get_git_commit_hash output)
|
||||
# full commit hash
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} log -1 --format="%H"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE ${output}
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endmacro()
|
||||
|
||||
macro(get_git_commit_date output)
|
||||
# 2024-06-02T20:17:41+00:00
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} log -1 --format="%cI"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE ${output}
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endmacro()
|
||||
|
||||
macro(get_git_commit_subject output)
|
||||
# message from `git commit -m "message"`
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} log -1 --format="%s"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_COMMIT_SUBJECT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endmacro()
|
Reference in New Issue
Block a user