From dccfcfc901a6b5a6d85d52567ebfa1569832b61c Mon Sep 17 00:00:00 2001 From: Dane Madsen Date: Mon, 4 Mar 2024 09:48:25 +1000 Subject: [PATCH] Update CMakeLists.txt --- common/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 5148c77d1..350bbdf7f 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -4,7 +4,7 @@ # Build info header # -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../.git/index") +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../.git") set(GIT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../.git") # Is git submodule @@ -19,7 +19,12 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../.git/index") 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 "")