summaryrefslogtreecommitdiffstats
path: root/libversion/gitversion.cpp.in
diff options
context:
space:
mode:
Diffstat (limited to 'libversion/gitversion.cpp.in')
-rw-r--r--libversion/gitversion.cpp.in16
1 files changed, 16 insertions, 0 deletions
diff --git a/libversion/gitversion.cpp.in b/libversion/gitversion.cpp.in
new file mode 100644
index 0000000..164b50b
--- /dev/null
+++ b/libversion/gitversion.cpp.in
@@ -0,0 +1,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;
+}