From: Cordell Bloor <cgmb@debian.org>
Date: Tue, 18 Nov 2025 15:04:52 -0700
Subject: optional git

Git is only used to print a message during the build. The message is
not useful when building from a tarball or from the salsa git repo.

Forwarded: no
---
 library/CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
index af98e18..5f600fc 100644
--- a/library/CMakeLists.txt
+++ b/library/CMakeLists.txt
@@ -45,8 +45,9 @@ if( BUILD_VERBOSE )
 endif( )
 
 # Get the git hash of the hipBLAS branch
-find_package(Git REQUIRED)
+find_package(Git)
 
+if(Git_FOUND)
 execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse HEAD
                 WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
                 OUTPUT_VARIABLE GIT_HASH_HIPBLAS
@@ -56,6 +57,7 @@ set(hipblas_VERSION_COMMIT_ID "${GIT_HASH_HIPBLAS}")
 
 # log build commits
 message( STATUS "*** Building hipBLAS commit: ${hipblas_VERSION_COMMIT_ID}" )
+endif()
 
 # configure a header file to pass the CMake version settings to the source, and package the header files in the output archive
 configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/include/hipblas-version.h.in" "${PROJECT_BINARY_DIR}/include/hipblas/hipblas-version.h" )
