Fix CMake when git is not found. (#64)

Fix: https://github.com/ArthurSonzogni/FTXUI/issues/62
This commit is contained in:
Arthur Sonzogni 2020-11-22 13:23:01 +01:00 committed by GitHub
parent afd53e0508
commit 977f13967f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,11 +1,17 @@
cmake_minimum_required(VERSION 3.0)
execute_process(
COMMAND git rev-list --count HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE git_version
OUTPUT_STRIP_TRAILING_WHITESPACE
)
find_package(Git QUIET)
if (Git_FOUND)
message("git found")
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE git_version
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
set(git_version 0)
endif()
project(ftxui
LANGUAGES CXX