From: Mathias Preiner Date: Wed, 19 Sep 2018 15:24:11 +0000 (-0700) Subject: cmake: Guard GetGitRevisionDescription. X-Git-Tag: cvc5-1.0.0~4536 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bd5067d49cc113750887b62f865df8048c648cce;p=cvc5.git cmake: Guard GetGitRevisionDescription. --- diff --git a/src/base/CMakeLists.txt b/src/base/CMakeLists.txt index 9ef564df8..d190ec199 100644 --- a/src/base/CMakeLists.txt +++ b/src/base/CMakeLists.txt @@ -3,17 +3,25 @@ include(GetGitRevisionDescription) get_git_head_revision(GIT_REFSPEC GIT_SHA1) -git_local_changes(GIT_IS_DIRTY) -if(${GIT_IS_DIRTY} STREQUAL "DIRTY") - set(GIT_IS_DIRTY "true") + +if(GIT_SHA1) + git_local_changes(GIT_IS_DIRTY) + set(GIT_BUILD "true") + if(${GIT_IS_DIRTY} STREQUAL "DIRTY") + set(GIT_IS_DIRTY "true") + else() + set(GIT_IS_DIRTY "false") + endif() + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD + OUTPUT_VARIABLE GIT_BRANCH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) else() + set(GIT_BUILD "false") set(GIT_IS_DIRTY "false") + set(GIT_SHA1 "") endif() -execute_process( - COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD - OUTPUT_VARIABLE GIT_BRANCH - OUTPUT_STRIP_TRAILING_WHITESPACE -) #-----------------------------------------------------------------------------# # Generate git_versioninfo.cpp diff --git a/src/base/git_versioninfo.cpp.in b/src/base/git_versioninfo.cpp.in index e601a851a..20da094bc 100644 --- a/src/base/git_versioninfo.cpp.in +++ b/src/base/git_versioninfo.cpp.in @@ -1,5 +1,5 @@ #include "base/configuration.h" -const bool ::CVC4::Configuration::IS_GIT_BUILD = true; +const bool ::CVC4::Configuration::IS_GIT_BUILD = @GIT_BUILD@; const char* const ::CVC4::Configuration::GIT_BRANCH_NAME = "@GIT_BRANCH@"; const char* const ::CVC4::Configuration::GIT_COMMIT = "@GIT_SHA1@"; const bool ::CVC4::Configuration::GIT_HAS_MODIFICATIONS = @GIT_IS_DIRTY@;