mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 13:51:33 -06:00
CMakeVersion: Preserve Git information during 'git archive'
Use `export-subst` to get information about the Git commit used to produce an archive.
This commit is contained in:
2
Source/.gitattributes
vendored
2
Source/.gitattributes
vendored
@@ -1,2 +1,4 @@
|
||||
CMakeVersion.cmake export-subst
|
||||
|
||||
# Do not format third-party sources.
|
||||
/kwsys/** -format.clang-format-6.0
|
||||
|
||||
@@ -39,6 +39,9 @@ if(COMMAND _git)
|
||||
# Get the commit checked out in this work tree.
|
||||
_git(log -n 1 HEAD "--pretty=format:%h %s" --)
|
||||
set(git_info "${_git_out}")
|
||||
else()
|
||||
# Get the commit exported by 'git archive'.
|
||||
set(git_info [==[$Format:%h %s$]==])
|
||||
endif()
|
||||
|
||||
# Extract commit information if available.
|
||||
|
||||
Reference in New Issue
Block a user