diff options
author | Dane Madsen <dane_madsen@hotmail.com> | 2024-03-05 05:26:55 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-04 20:26:55 +0200 |
commit | fe52be11e35358d2fd249f19d7ef5b6f9c08b16b (patch) | |
tree | 2c854b53cbc445cb19dc4d2061c93703928e93c6 | |
parent | 6d341ab6c53cd51f2921d986d0090cc8b049b39a (diff) |
cmake : handle cases where git index is not found in .git (#5844)
* Update CMakeLists.txt
* Update CMakeLists.txt
-rw-r--r-- | common/CMakeLists.txt | 7 |
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 "") |