summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAndrew <forkk@forkk.net>2013-02-21 11:02:48 -0600
committerAndrew <forkk@forkk.net>2013-02-21 11:02:48 -0600
commit96e4f73a94e0697ce7200e09983d447220ea5a0b (patch)
tree52253cf8474a174f202ca58ce9c5c9191bb4582a /CMakeLists.txt
parentfaddeb2c130157496cd2fd2853fd33a4fc95a0d1 (diff)
downloadMultiMC-96e4f73a94e0697ce7200e09983d447220ea5a0b.tar
MultiMC-96e4f73a94e0697ce7200e09983d447220ea5a0b.tar.gz
MultiMC-96e4f73a94e0697ce7200e09983d447220ea5a0b.tar.lz
MultiMC-96e4f73a94e0697ce7200e09983d447220ea5a0b.tar.xz
MultiMC-96e4f73a94e0697ce7200e09983d447220ea5a0b.zip
Include Git commit hash in config.h
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt19
1 files changed, 18 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e6a1d0cc..edb58ef2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -93,10 +93,27 @@ SET(MultiMC_VERSION_MAJOR 5)
SET(MultiMC_VERSION_MINOR 0)
SET(MultiMC_VERSION_REV 0)
-# Jenkins build number.
+# Jenkins build number
SET(MultiMC_VERSION_BUILD 0 CACHE STRING "Build number.")
MESSAGE(STATUS "MultiMC build #${MultiMC_VERSION_BUILD}")
+# Check the current Git commit
+execute_process(COMMAND git rev-parse HEAD
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ RESULT_VARIABLE GIT_COMMIT_CHECK_RESULTVAR
+ OUTPUT_VARIABLE GIT_COMMIT_CHECK_OUTVAR
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
+# If Git executed successfully
+IF(GIT_COMMIT_CHECK_RESULTVAR EQUAL 0)
+ SET(MultiMC_GIT_COMMIT "${GIT_COMMIT_CHECK_OUTVAR}")
+ MESSAGE(STATUS "Git commit: ${MultiMC_GIT_COMMIT}")
+ELSE()
+ SET(MultiMC_GIT_COMMIT "Unknown")
+ MESSAGE(STATUS "Failed to check Git commit. ${GIT_COMMIT_CHECK_RESULTVAR}")
+ENDIF()
+
######## Set Jenkins info ########
# Jenkins build tag