commit 45c8679493c628353f6672e940c9ae4fd27dfe84
parent 0f911390744f0836604b70f4ebb496dbe372400d
Author: dundargoc <gocdundar@gmail.com>
Date: Fri, 21 Oct 2022 11:57:10 +0200
build: give example on complex regexes
This is just to allow the reader to get a quick understanding without
necessarily needing to know all the regex intricasies.
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/cmake/GenerateVersion.cmake b/cmake/GenerateVersion.cmake
@@ -16,7 +16,9 @@ endif()
# `git describe` annotates the most recent tagged release; for pre-release
# builds we append that to the dev version.
if(NVIM_VERSION_PRERELEASE)
+ # Extract pre-release info: "v0.8.0-145-g0f9113907" => "145-g0f9113907"
string(REGEX REPLACE "^v[0-9]+.[0-9]+.[0-9]+-" "" NVIM_VERSION_GIT "${GIT_TAG}")
+ # Replace "-" with "+": "145-g0f9113907" => "145+g0f9113907"
string(REGEX REPLACE "^([0-9]+)-([a-z0-9]+)" "\\1+\\2" NVIM_VERSION_GIT "${NVIM_VERSION_GIT}")
set(NVIM_VERSION "${NVIM_VERSION}-${NVIM_VERSION_GIT}")
endif()