From c83be332d5073d056a16a7e085f3667892470d35 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Tue, 31 Dec 2024 11:58:35 +0100 Subject: [PATCH] Fix version and commit display Made version and commit variables static, and local to the version display function. Previously, they would be globals, and as such would collide with those from linked shared libraries. Now, all project types will have them local. --- tpl/Makefile.unified | 4 ++-- tpl/version.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tpl/Makefile.unified b/tpl/Makefile.unified index edb6384..032d08b 100644 --- a/tpl/Makefile.unified +++ b/tpl/Makefile.unified @@ -2,8 +2,8 @@ include premake.make # git commit hash and version for this build COMMIT-HASH != git log 2>/dev/null | sed -e '1s/^commit //;q' -COMMIT := "const char* commit = \"$(COMMIT-HASH)\";" -VERSION := "const char* version = \"$(MAJOR).$(MINOR).$(PATCH)\";" +COMMIT := "static const char* commit = \"$(COMMIT-HASH)\";" +VERSION := "static const char* version = \"$(MAJOR).$(MINOR).$(PATCH)\";" # some important install locations PREFIX ?= /usr/local diff --git a/tpl/version.cpp b/tpl/version.cpp index 0df3638..e95f8bc 100644 --- a/tpl/version.cpp +++ b/tpl/version.cpp @@ -1,9 +1,9 @@ #include "version.hpp" -#include "version.inc" -#include "commit.inc" #include std::string {PROJECT}_version() { +#include "version.inc" +#include "commit.inc" std::ostringstream oss; oss << "{PROJECT} version " << version; #ifdef DEBUG