Set git_version when .git folder is missing (#116)

If we download the FTXUI source archive from the GitHub website, then the `.git` folder will be missing.
In such case, CMake configuration will fail:
> git found
> fatal: not a git repository (or any of the parent directories): .git
> CMake Error at CMakeLists.txt:21 (project):
>   VERSION "0.6." format invalid.
This commit is contained in:
myd7349 2021-06-17 18:54:26 +08:00 committed by GitHub
parent 2406e20f36
commit 3d5e4eb6ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.0)
find_package(Git QUIET)
if (Git_FOUND)
if (Git_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
message("git found")
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD