From 3d5e4eb6ca11a0827bff68a04f4bf68ca9820e20 Mon Sep 17 00:00:00 2001 From: myd7349 Date: Thu, 17 Jun 2021 18:54:26 +0800 Subject: [PATCH] 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. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9926417..e6eb51a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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