Handle case where ioq3 is present as a git submodule

This commit is contained in:
Tim Angus 2025-10-18 13:01:20 +01:00
parent 139695d196
commit c891c337cb

View File

@ -6,6 +6,17 @@ function(add_git_dependency SOURCE_FILE)
return()
endif()
# If we're a submodule, .git won't be a directory
if(NOT IS_DIRECTORY ${GIT_DIR})
file(READ ${GIT_DIR} GIT_FILE_CONTENT)
string(REGEX MATCH "gitdir: (.+)" MATCHED_PATH ${GIT_FILE_CONTENT})
if(NOT MATCHED_PATH)
return()
endif()
string(STRIP ${CMAKE_MATCH_1} GIT_DIR)
endif()
set(GIT_FILES)
list(APPEND GIT_FILES ${GIT_DIR}/HEAD)
list(APPEND GIT_FILES ${GIT_DIR}/packed-refs)