From 0233088565bc85d5e67f508c2be1e23e03c415ce Mon Sep 17 00:00:00 2001 From: Lephe Date: Tue, 11 May 2021 08:27:24 +0200 Subject: [PATCH] cmake: do not require a build from the gint tree (#15) --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5dcb107..b985ef3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,12 @@ option(GINT_KMALLOC_DEBUG "Enable debug functions for kmalloc") set(CMAKE_INSTALL_MESSAGE LAZY) # Generate with commit hash, version name and options -git_version_number(SHORT_HASH "GINT_GIT_HASH" TAG_RELATIVE "GINT_GIT_VERSION") +if(EXISTS "${CMAKE_SOURCE_DIR}/.git") + git_version_number(SHORT_HASH "GINT_GIT_HASH" TAG_RELATIVE "GINT_GIT_VERSION") +else() + set(GINT_GIT_HASH "") + set(GINT_GIT_VERSION "${PROJECT_VERSION}") +endif() configure_file(include/gint/config.h.in include/gint/config.h) set(SOURCES_COMMON