mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-20 13:22:22 -05: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.
|
# Do not format third-party sources.
|
||||||
/kwsys/** -format.clang-format-6.0
|
/kwsys/** -format.clang-format-6.0
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ if(COMMAND _git)
|
|||||||
# Get the commit checked out in this work tree.
|
# Get the commit checked out in this work tree.
|
||||||
_git(log -n 1 HEAD "--pretty=format:%h %s" --)
|
_git(log -n 1 HEAD "--pretty=format:%h %s" --)
|
||||||
set(git_info "${_git_out}")
|
set(git_info "${_git_out}")
|
||||||
|
else()
|
||||||
|
# Get the commit exported by 'git archive'.
|
||||||
|
set(git_info [==[$Format:%h %s$]==])
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Extract commit information if available.
|
# Extract commit information if available.
|
||||||
|
|||||||
Reference in New Issue
Block a user