Skip to content

Commit

Permalink
Improve handling of build not in a Git repository
Browse files Browse the repository at this point in the history
If Git is installed but the build is not running in a Git repository, then git rev-parse will fail and GIT_COMMIT_STRING will be empty.
  • Loading branch information
Ortham committed May 18, 2024
1 parent d2aa978 commit 7108d84
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ if(GIT_FOUND)
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
endif()

if(NOT GIT_COMMIT_STRING)
set(GIT_COMMIT_STRING "unknown")
endif()

Expand Down

0 comments on commit 7108d84

Please sign in to comment.