Subject: Re: [PATCH v3 1/8] Introduce CMake support for configuring Git

From: Đoàn Trần Công Danh <[email-masked]>
Date: Sat, 30 May 2020 20:17:30 +0700

Hi Sibi,

On 2020-05-29 13:40:17+0000, Sibi Siddharthan via GitGitGadget <[email-masked]> wrote:
> +file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE git_version REGEX "GIT_VERSION = (.*)")
> +string(REPLACE "GIT_VERSION = " "" git_version ${git_version})
> +string(FIND ${git_version} "GIT" location)
> +if(location EQUAL -1)
> +	string(REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*" git_version ${git_version})

This will strip everything begins with first non-number.

With the same Git repo,
The git binary generated via Makefile reports version:

	git version 2.27.0.rc2.274.g860c8aebb9.dirty

The git binary generated via CMake reports:

	git version 2.27.0.GIT

Anyway, I pretty much defer this step to build step. Since this will
report the version when *cmake* is run. And *cmake* will be unlikely
run again if nothing related to CMake is being changed.

-- 
Danh