Avoid 'not a git repository (or any of the parent directories)' during configuration

Try to append the Git revision only if the source directory is actually a
Git checkout.
This commit is contained in:
Martchus 2020-09-12 22:24:45 +02:00
parent 6f6c2e607f
commit 26b6ef0486
2 changed files with 3 additions and 3 deletions

View File

@ -114,7 +114,7 @@ set(META_APP_DESCRIPTION "Useful C++ classes and routines such as argument parse
set(META_FEATURES_FOR_COMPILER_DETECTION_HEADER cxx_thread_local)
set(META_VERSION_MAJOR 5)
set(META_VERSION_MINOR 6)
set(META_VERSION_PATCH 0)
set(META_VERSION_PATCH 1)
# find required 3rd party libraries
include(3rdParty)

View File

@ -167,9 +167,9 @@ endif ()
set(META_APP_VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH})
option(
APPEND_GIT_REVISION
"whether the build script should attempt to append the git revision and latest commit to the version displayed via --help"
"whether the build script should attempt to append the Git revision and latest commit to the version displayed via --help"
ON)
if (APPEND_GIT_REVISION)
if (APPEND_GIT_REVISION AND (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git" OR EXISTS "${CMAKE_SOURCE_DIR}/.git"))
find_program(GIT_BIN git)
execute_process(
COMMAND ${GIT_BIN} rev-list --count HEAD