From 1fa099d818eaee2a4fb3b818ada110f2465ace79 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 22 Mar 2020 12:57:53 +0100 Subject: CMake: use 'git describe' over 'git log' to obtain version number This is more efficient as its a Git build in function. If build from a non tagged commit, the version number will be extended by the "git describe" way: $ dpkg -I accel-ppp/build/_CPack_Packages/Linux/DEB/accel-ppp.deb | grep Vers Version: 1.12.0-53-g7afe0f0 The version indicator shows that the last Accel-PPP release was 1.12.0 (which was tagged) and we are now 53 commits past the 1.12.0 tag. The current commit id is 7afe0f0 (short form). After installation the Debian package database will show: $ dpkg -l | grep accel ii accel-ppp 1.12.0-53-g7afe0f0 amd64 PPtP/L2TP/PPPoE/SSTP server for Linux Also the embedded version command will show: $ accel-cmd -p 2005 -V accel-cmd 1.12.0-53-g7afe0f0 Signed-off-by: Christian Poessinger --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d86ff70..dd457777 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,9 +38,7 @@ ENDIF(NOT PCRE_LIBRARY) IF (EXISTS ${CMAKE_HOME_DIRECTORY}/.git AND NOT IGNORE_GIT) EXECUTE_PROCESS( - COMMAND git log --no-color - COMMAND head -n1 - COMMAND awk "{print $2}" + COMMAND git describe --tags --always WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY} OUTPUT_VARIABLE ACCEL_PPP_VERSION ) -- cgit v1.2.3