Hi Sibi, On 2020-05-29 13:40:17+0000, Sibi Siddharthan via GitGitGadget <gitgitgadget@xxxxxxxxx> 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