diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e3ca9d5fc..e0a2e990e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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")