Blob Blame History Raw
From 192064f4567c9706da493b0e55fc9ed33000305a Mon Sep 17 00:00:00 2001
From: Harald Sitter <sitter@kde.org>
Date: Wed, 12 May 2021 14:49:06 +0200
Subject: [PATCH 04/24] repair the version header

this had likely been broken ever since the module got folded into
kinfocenter :(

it occurred to me that the previous code was daft anyway, that's why it
broke. the way we defined the variable would hide the cmake-side
variable being undefined/falsey. by using cmakedefine the macro is only
defined iff the variable is not undefined/falsey and as a consequence
the build would fail if the variable is undefined as then the
PROJECT_VERSION identifier is undeclared.

in conclusion the new code will fail if the variable is not defined,
explicitly undef, explicit OFF etc., ensuring that moving forward we
have a version.
---
 Modules/about-distro/src/Module.cpp      | 2 +-
 Modules/about-distro/src/Version.h.cmake | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Modules/about-distro/src/Module.cpp b/Modules/about-distro/src/Module.cpp
index e5488c2..796cfb8 100644
--- a/Modules/about-distro/src/Module.cpp
+++ b/Modules/about-distro/src/Module.cpp
@@ -33,7 +33,7 @@ Module::Module(QWidget *parent, const QVariantList &args) :
 {
     KAboutData *aboutData = new KAboutData(QStringLiteral("kcm-about-distro"),
                                            i18nc("@title", "About System"),
-                                           QString::fromLatin1(global_s_versionStringFull),
+                                           QStringLiteral(PROJECT_VERSION),
                                            QString(),
                                            KAboutLicense::LicenseKey::GPL_V3,
                                            i18nc("@info:credit", "Copyright 2012-2020 Harald Sitter"));
diff --git a/Modules/about-distro/src/Version.h.cmake b/Modules/about-distro/src/Version.h.cmake
index e087604..883c904 100644
--- a/Modules/about-distro/src/Version.h.cmake
+++ b/Modules/about-distro/src/Version.h.cmake
@@ -21,7 +21,7 @@
 #ifndef VERSION_H
 #define VERSION_H
 
-static const char global_s_versionString[] = "${VERSION_STRING}";
-static const char global_s_versionStringFull[] = "${VERSION_STRING_FULL}";
+// NOTE: we want the cmakedefine so undefined cmake variables result in undefined macros result in build failures when they are used!
+#cmakedefine PROJECT_VERSION "@PROJECT_VERSION@"
 
 #endif // VERSION_H
-- 
2.31.1