about summary refs log tree commit diff homepage
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2016-11-03 15:28:55 +0000
committerDan Liew <delcypher@gmail.com>2016-11-07 22:16:29 +0000
commite853f0bceeb7099acc3df16e52a3cfd1dabad422 (patch)
tree4a6e2c43d500ed1cce6f622ebaa9c68ba09737ec /CMakeLists.txt
parent6c2bba097639922244201e6140f71ccd14e335c3 (diff)
downloadklee-e853f0bceeb7099acc3df16e52a3cfd1dabad422.tar.gz
[CMake] Report git revision information if available.
This is done as a separate commit because it imports
third party code. It's under the Boost license though
so it "should be" fine.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt16
1 files changed, 14 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bede4bc7..94ed344a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -583,8 +583,20 @@ configure_file(${CMAKE_SOURCE_DIR}/include/klee/Config/config.h.cmin
 ################################################################################
 # Generate `CompileTimeInfo.h`
 ################################################################################
-# FIXME: Get information from git and have configure depend on this so we
-# only re-generate the file when necessary.
+if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
+  # Get information from git. We use third-party code to do this. The nice
+  # thing about this code is it will trigger a re-configure if the HEAD changes
+  # which means when we build KLEE, it should always have the correct git
+  # information.
+  include(${CMAKE_SOURCE_DIR}/cmake/GetGitRevisionDescription.cmake)
+  get_git_head_revision(_NOT_USED_KLEE_GIT_REFSPEC KLEE_GIT_SHA1HASH)
+  message(STATUS "KLEE_GIT_SHA1HASH: ${KLEE_GIT_SHA1HASH}")
+  git_describe(KLEE_GIT_TAG "--tags")
+  message(STATUS "KLEE_GIT_TAG: ${KLEE_GIT_TAG}")
+else()
+  set(KLEE_GIT_SHA1HASH "unknown")
+  set(KLEE_GIT_TAG "unknown")
+endif()
 set(AUTO_GEN_MSG "AUTOMATICALLY GENERATED. DO NOT EDIT!")
 configure_file(${CMAKE_SOURCE_DIR}/include/klee/Config/CompileTimeInfo.h.cmin
   ${CMAKE_BINARY_DIR}/include/klee/Config/CompileTimeInfo.h