Fix CMake build when git revision can't be determined

This commit is contained in:
Gleb Popov
2021-03-15 10:25:54 +03:00
committed by Laurent Trinques
parent 491efe7b1d
commit 86f8b85a78

View File

@@ -28,9 +28,6 @@ if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# This strips terminating newline in the variable # This strips terminating newline in the variable
string(REGEX REPLACE "\n$" "" GIT_COMMIT_SHA "${GIT_COMMIT_SHA}") string(REGEX REPLACE "\n$" "" GIT_COMMIT_SHA "${GIT_COMMIT_SHA}")
# This adds to definitions => .cpp
add_definitions(-DGIT_COMMIT_SHA="${GIT_COMMIT_SHA}")
if(NOT GIT_COMMIT_RESULT EQUAL "0") if(NOT GIT_COMMIT_RESULT EQUAL "0")
message( message(
FATAL_ERROR FATAL_ERROR
@@ -39,3 +36,6 @@ if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
", please check") ", please check")
endif() endif()
endif() endif()
# This adds to definitions => .cpp
add_definitions(-DGIT_COMMIT_SHA="${GIT_COMMIT_SHA}")