Skip to content

Commit c752df5

Browse files
danemadsenhazelnutcloud
authored andcommitted
cmake : handle cases where git index is not found in .git (ggml-org#5844)
* Update CMakeLists.txt * Update CMakeLists.txt
1 parent f93f315 commit c752df5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

common/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../.git")
1919
endif()
2020
endif()
2121

22-
set(GIT_INDEX "${GIT_DIR}/index")
22+
if(EXISTS "${GIT_DIR}/index")
23+
set(GIT_INDEX "${GIT_DIR}/index")
24+
else()
25+
message(WARNING "Git index not found in git repository.")
26+
set(GIT_INDEX "")
27+
endif()
2328
else()
2429
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.")
2530
set(GIT_INDEX "")

0 commit comments

Comments
 (0)