summaryrefslogtreecommitdiffstats
path: root/libversion/gitversion.cpp.in
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2019-05-31 18:03:45 (GMT)
committeralbert-github <albert.tests@gmail.com>2019-05-31 18:03:45 (GMT)
commit4ad23e5d18fc294e00844fd8557f8c5dd6254d6e (patch)
tree54add50b60dc75b677dc62afc84aad4014b0d9a2 /libversion/gitversion.cpp.in
parentfa9dda01e6c013c7fe9be99b21d8bbf3c95c0482 (diff)
downloadDoxygen-4ad23e5d18fc294e00844fd8557f8c5dd6254d6e.zip
Doxygen-4ad23e5d18fc294e00844fd8557f8c5dd6254d6e.tar.gz
Doxygen-4ad23e5d18fc294e00844fd8557f8c5dd6254d6e.tar.bz2
Show git version information
The original version has as features: - getting the git version number for usage in doxygen - making the doxygen version number inclusion dependent on the VERSION file The disadvantage of the chosen methodology was that an extra correction step was necessary, by defining getter methods to retrieve the values this correction can be hidden. The information is coming from different sources: - the VERSION file - the git "repository and build system (when present) Furthermore there are a couple of places where the version information is used (a.o. doxygen and doxywizard executable, though the doxygenwizard was only done "half hearted") The handling of the VERSION file has been made in such a way that it is comparable with the generation of the git version changes. For a better abstraction the version handling is all done in a separate directory.
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;
+}