feat(CMakeLists.txt): add option USE_GITHASH (default:on)
related issue: #733
This commit is contained in:
parent
16f50d9aea
commit
c72e661a9e
1 changed files with 16 additions and 6 deletions
|
@ -35,6 +35,8 @@ option(CONSERVE_MEMORY "CONSERVE_MEMORY" OFF)
|
|||
option(INCLUDE_MSYS2_DLLS "INCLUDE_MSYS2_DLLS" OFF)
|
||||
# When ON we add lean binary dependency to standard and HOTT libraries
|
||||
option(LEAN_BIN_DEP "LEAN_BIN_DEP" ON)
|
||||
# When ON we include githash in the version string
|
||||
option(USE_GITHASH "GIT_HASH" ON)
|
||||
# Directory that include lean emacs mode dependecies
|
||||
set(EMACS_DEPENDENCIES "${CMAKE_SOURCE_DIR}/emacs/dependencies")
|
||||
|
||||
|
@ -266,17 +268,25 @@ find_package(PythonInterp REQUIRED)
|
|||
include_directories(${LEAN_SOURCE_DIR})
|
||||
|
||||
# Git HASH
|
||||
include(GetGitRevisionDescription)
|
||||
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
|
||||
set(LEAN_PACKAGE_VERSION "NOT-FOUND")
|
||||
if(${GIT_SHA1} MATCHES "GITDIR-NOTFOUND")
|
||||
message(STATUS "Failed to read git_sha1")
|
||||
if(USE_GITHASH)
|
||||
include(GetGitRevisionDescription)
|
||||
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
|
||||
if(${GIT_SHA1} MATCHES "GITDIR-NOTFOUND")
|
||||
message(STATUS "Failed to read git_sha1")
|
||||
if(EXISTS "${LEAN_SOURCE_DIR}/../bin/package_version")
|
||||
file(STRINGS "${LEAN_SOURCE_DIR}/../bin/package_version" LEAN_PACKAGE_VERSION)
|
||||
message(STATUS "Package version detected: ${LEAN_PACKAGE_VERSION}")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "git commit sha1: ${GIT_SHA1}")
|
||||
endif()
|
||||
else()
|
||||
set(GIT_SHA1 "GITDIR-NOTFOUND")
|
||||
if(EXISTS "${LEAN_SOURCE_DIR}/../bin/package_version")
|
||||
file(STRINGS "${LEAN_SOURCE_DIR}/../bin/package_version" LEAN_PACKAGE_VERSION)
|
||||
message(STATUS "Package version detected: ${LEAN_PACKAGE_VERSION}")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "git commit sha1: ${GIT_SHA1}")
|
||||
endif()
|
||||
configure_file("${LEAN_SOURCE_DIR}/githash.h.in" "${LEAN_BINARY_DIR}/githash.h")
|
||||
|
||||
|
|
Loading…
Reference in a new issue