FairProjectConfig

Added in version 1.0.0.

Requires CMake 3.12 or later.


fair_get_git_version()

fair_get_git_version([OUTVAR_PREFIX prefix]
                     [TAGS_ONLY] [REQUIRED])

The function checks git attributes of the current tree. If it can’t detect anything useful (becausee Git is not installed, or because there is no git repository), it will not touch any output variables at all.

OUTVAR_PREFIX

This option sets the prefix for created variables. It defaults to "PROJECT".

TAGS_ONLY

This option tells Git to search for tags and use them as base for the returned information. If this option is not given, Git can also return a (shortened) commit hash. (Current implementation detail: not passing this option will pass --always to git describe.)

REQUIRED

If no suitable information can be detected (for example TAGS_ONLY is given, but no tags exist, or no git repository exists) then a fatal error is raised.

Output variables:

<prefix>_GIT_VERSION

A version string that is created from the output of git describe.