summaryrefslogtreecommitdiffstats
path: root/libversion/gitversion.cpp.in
blob: 164b50b24bfa38ea86261ccc54f09c72693d9bdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <string.h>
#include <version.h>

/* - On some systems git is not installed or
 *   installed on a place where FindGit.cmake cannot find it
 * - No git information is present (no .git directory)
 * in those cases clear the gitVersionString (would have string GIT-NOTFOUND).
 */
char *getGitVersion(void)
{
  static char gitVersionString[100];
  strcpy(gitVersionString,"@GIT_HEAD_SHA1@");
  strcat(gitVersionString,!strcmp("@GIT_IS_DIRTY@","true")?"*":"");
  if (!strcmp("@GIT_HEAD_SHA1@", "GIT-NOTFOUND")) gitVersionString[0] = '\0';
  return gitVersionString;
}