summaryrefslogtreecommitdiffstats
path: root/Source/CMakeVersion.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-07-25 13:17:53 (GMT)
committerBrad King <brad.king@kitware.com>2019-07-29 15:37:32 (GMT)
commitfe2c558ba66dd6a12cf9289adf692c9a76c71ef4 (patch)
tree57d42b25f9825ccdfdcef8b523ee255f11d15617 /Source/CMakeVersion.cmake
parent0505a66cbf6c42ffa3592c9866c5772e7806f5fc (diff)
downloadCMake-fe2c558ba66dd6a12cf9289adf692c9a76c71ef4.zip
CMake-fe2c558ba66dd6a12cf9289adf692c9a76c71ef4.tar.gz
CMake-fe2c558ba66dd6a12cf9289adf692c9a76c71ef4.tar.bz2
CMakeVersion: Preserve Git information during 'git archive'
Use `export-subst` to get information about the Git commit used to produce an archive.
Diffstat (limited to 'Source/CMakeVersion.cmake')
-rw-r--r--Source/CMakeVersion.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 32a40f9..193c14f 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -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.