Skip to content

Commit 2d44cd0

Browse files
committed
build: handle missing git version
1 parent 2f58053 commit 2d44cd0

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,21 @@ endif()
132132
delogohd_add_vapoursynth_compat_headers(delogohd_vapoursynth_headers)
133133

134134
find_package(Git)
135+
set(GIT_REPO_VERSION "unknown-version")
135136
if(GIT_FOUND)
136137
execute_process(
137138
COMMAND ${GIT_EXECUTABLE} describe --first-parent --tags --always
138139
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
139140
OUTPUT_VARIABLE GIT_REPO_VERSION
141+
RESULT_VARIABLE GIT_REPO_VERSION_RESULT
142+
ERROR_QUIET
140143
OUTPUT_STRIP_TRAILING_WHITESPACE
141144
)
142-
else()
143-
set(GIT_REPO_VERSION "unknown")
145+
if(NOT GIT_REPO_VERSION_RESULT EQUAL 0 OR GIT_REPO_VERSION STREQUAL "")
146+
set(GIT_REPO_VERSION "unknown-version")
147+
endif()
144148
endif()
145-
string(REGEX REPLACE "^(r[0-9]+).*$" "\\1" VERSION "${GIT_REPO_VERSION}")
149+
string(REGEX REPLACE "^(v[0-9]+(\\.[0-9]+)*).*$" "\\1" VERSION "${GIT_REPO_VERSION}")
146150

147151
set(DELOGOHD_GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
148152
configure_file(

0 commit comments

Comments
 (0)