On Mon, 8 Jan 2024 16:56:16 -0600
"David C. Rankin" <drankina...@gmail.com> wrote:

>    There is no way to pull from the internal CPACK name to get precisely the 
> CPACK_PACKAGE_VERSION out of it. You also cannot simply add a "TZST"
> generator and then either "cmake --build . --target package" or "make
> package" to use the zst generator as it would bypass the pacman package()
> altogether.
> 
>    You can change the format to meet your suggestion of
> 
>    r(commit count).g(commit)
> 
> but that is about the best I was able to work out. If you know some
> additional cmake magic I missed that allows grabbing the name from one of the
> generated files in a format better than that above, you will have to help me
> with it, I couldn't find it.

I don't know of a way directly. The format you mentioned here works, as if a
tag is added, you can easily switch to git describe without having to add an
epoch. If you want to match upstream closer, you can do it by parsing
CMakeLists.txt directly, something like
 awk 'match($0,/set\(PROJECT_VERSION ([0-9.]*)/,a) {print a[1];}' CMakeLists.txt
to get you the project version, then add the rest.

Reply via email to