27 lines
784 B
CMake
27 lines
784 B
CMake
|
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()
|