summaryrefslogtreecommitdiff
path: root/common/CMakeLists.txt
diff options
context:
space:
mode:
authorDane Madsen <dane_madsen@hotmail.com>2024-03-05 05:26:55 +1100
committerGitHub <noreply@github.com>2024-03-04 20:26:55 +0200
commitfe52be11e35358d2fd249f19d7ef5b6f9c08b16b (patch)
tree2c854b53cbc445cb19dc4d2061c93703928e93c6 /common/CMakeLists.txt
parent6d341ab6c53cd51f2921d986d0090cc8b049b39a (diff)
cmake : handle cases where git index is not found in .git (#5844)
* Update CMakeLists.txt * Update CMakeLists.txt
Diffstat (limited to 'common/CMakeLists.txt')
-rw-r--r--common/CMakeLists.txt7
1 files changed, 6 insertions, 1 deletions
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index f79acfef..350bbdf7 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -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 "")