-
Notifications
You must be signed in to change notification settings - Fork 95
/
gen-git-info.cmake
44 lines (42 loc) · 1.33 KB
/
gen-git-info.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
## gen-git-info.cmake
##
## Copyright (C) 2020-2022 Christian Schenk
##
## This file is free software; the copyright holder gives
## unlimited permission to copy and/or distribute it, with or
## without modifications, as long as this notice is preserved.
if("$Format:%%$" STREQUAL "%")
set(MIKTEX_HAVE_GIT_INFO 1)
set(MIKTEX_GIT_COMMIT "$Format:%H$")
set(MIKTEX_GIT_COMMIT_ABBREV "$Format:%h$")
set(MIKTEX_GIT_AUTHOR_DATE $Format:%at$)
elseif(IS_DIRECTORY "${SOURCE_DIR}/.git" AND GIT_FOUND)
set(MIKTEX_HAVE_GIT_INFO 1)
execute_process(
COMMAND ${GIT_EXECUTABLE} show --no-patch --pretty=%H
WORKING_DIRECTORY "${SOURCE_DIR}"
OUTPUT_VARIABLE MIKTEX_GIT_COMMIT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${GIT_EXECUTABLE} show --no-patch --pretty=%h
WORKING_DIRECTORY "${SOURCE_DIR}"
OUTPUT_VARIABLE MIKTEX_GIT_COMMIT_ABBREV
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${GIT_EXECUTABLE} show --no-patch --pretty=%at
WORKING_DIRECTORY "${SOURCE_DIR}"
OUTPUT_VARIABLE MIKTEX_GIT_AUTHOR_DATE
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
set(MIKTEX_HAVE_GIT_INFO 0)
endif()
configure_file(
${GITINFO_H_IN}
${GITINFO_H}
)