forked from MiKTeX/miktex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen-git-info.cmake
54 lines (52 loc) · 1.73 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
45
46
47
48
49
50
51
52
53
54
## gen-git-info.cmake:
##
## Copyright (C) 2020 Christian Schenk
##
## This file is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.
##
## This file is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this file; if not, write to the Free Software Foundation,
## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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}
)