Skip to content

Commit

Permalink
cmake : handle cases where git index is not found in .git (ggerganov#…
Browse files Browse the repository at this point in the history
…5844)

* Update CMakeLists.txt

* Update CMakeLists.txt
  • Loading branch information
danemadsen authored and NeoZhangJianyu committed Mar 5, 2024
1 parent e245d6c commit 465e411
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../.git")
endif()
endif()

set(GIT_INDEX "${GIT_DIR}/index")
if(EXISTS "${GIT_DIR}/index")
set(GIT_INDEX "${GIT_DIR}/index")
else()
message(WARNING "Git index not found in git repository.")
set(GIT_INDEX "")
endif()
else()
message(WARNING "Git repository not found; to enable automatic generation of build info, make sure Git is installed and the project is a Git repository.")
set(GIT_INDEX "")
Expand Down

0 comments on commit 465e411

Please sign in to comment.