diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-03-22 12:57:53 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-03-22 13:01:43 +0100 |
commit | 1fa099d818eaee2a4fb3b818ada110f2465ace79 (patch) | |
tree | 395c864cc73d751862fabf3bd170d5e5e04b569e /CMakeLists.txt | |
parent | 9f3a32932eecb8fbf9ed4f747d7713380fbfc889 (diff) | |
download | accel-ppp-1fa099d818eaee2a4fb3b818ada110f2465ace79.tar.gz accel-ppp-1fa099d818eaee2a4fb3b818ada110f2465ace79.zip |
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 <christian@poessinger.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 4 |
1 files changed, 1 insertions, 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 ) |