From 62a542e824362c530abef7d122bfa9798c7e013e Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Tue, 11 Nov 2014 04:10:45 +0100 Subject: CMakeLists: Set git version if in git repo --- CMakeLists.txt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e7402dd..c48c6b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,11 +2,25 @@ cmake_minimum_required (VERSION 2.6) project (yawa) set(PACKAGE_NAME "yawa") -set(PACKAGE_VERSION "0.0.1") + +if(EXISTS ".git/") + find_package(Git) + if(GIT_FOUND) + execute_process( + COMMAND ${GIT_EXECUTABLE} describe + OUTPUT_VARIABLE GIT_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + set(PACKAGE_VERSION ${GIT_VERSION}) + endif() +else() + set(PACKAGE_VERSION "0.0.1") +endif() + set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_DESCRIPTION "Yet Another Wallpaper Application") set(PACKAGE_BUGREPORT "johannes@kyriasis.com") + set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") configure_file( -- cgit v1.2.3-70-g09d2