aboutsummaryrefslogtreecommitdiffstats
path: root/version.cmake
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-12-21 11:41:45 -0800
committerChris Robinson <[email protected]>2016-12-21 11:41:45 -0800
commit1b104dd77baeb6d991ec2ff279c87e6e46527d44 (patch)
treee9e6464bdc6053bb046a81fb5b359753667f1023 /version.cmake
parente270a9784bdacecedb98312a4e2e9ef75ef7df62 (diff)
More robustly generate the git commit ID and branch
Diffstat (limited to 'version.cmake')
-rw-r--r--version.cmake11
1 files changed, 11 insertions, 0 deletions
diff --git a/version.cmake b/version.cmake
new file mode 100644
index 00000000..af7ff0a6
--- /dev/null
+++ b/version.cmake
@@ -0,0 +1,11 @@
+EXECUTE_PROCESS(
+ COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
+ OUTPUT_VARIABLE GIT_BRANCH
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+EXECUTE_PROCESS(
+ COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
+ OUTPUT_VARIABLE GIT_COMMIT_HASH
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+CONFIGURE_FILE(${SRC} ${DST})