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) cmake_minimum_required(VERSION 3.0)
execute_process( find_package(Git QUIET)
COMMAND git rev-list --count HEAD if (Git_FOUND)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} message("git found")
OUTPUT_VARIABLE git_version execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE 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 project(ftxui
LANGUAGES CXX LANGUAGES CXX