diff --git a/.gitignore b/.gitignore index 8bade8c..6f3d2e9 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ .flatpak-builder/* /build*/ AndroidManifest.xml +/src/version.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ba44c69..795a936 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,6 +16,8 @@ add_subdirectory(model) add_subdirectory(validators) add_subdirectory(app) +configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/version.h") + set(keysmith_SRCS main.cpp ) diff --git a/src/main.cpp b/src/main.cpp index 25c7cd8..e742f9f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,6 +22,8 @@ #include "validators/issuervalidator.h" #include "validators/secretvalidator.h" +#include "version.h" + /* * Integrate QML debugging/profiling support, conditional on building Keysmith in Debug mode. * NDEBUG is defined by the C standard and automatically set by CMake during a Release type build, hence the double negative. @@ -40,6 +42,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) QCoreApplication::setOrganizationName(QStringLiteral("KDE")); QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org")); QCoreApplication::setApplicationName(QStringLiteral("Keysmith")); + QCoreApplication::setApplicationVersion(KEYSMITH_VERSION_STRING); QGuiApplication::setApplicationDisplayName(i18nc("@title", "Keysmith")); QCommandLineParser cliParser; diff --git a/src/version.h.in b/src/version.h.in new file mode 100644 index 0000000..e56c515 --- /dev/null +++ b/src/version.h.in @@ -0,0 +1,12 @@ +/* + * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2020 Johan Ouwerkerk + */ +#ifndef KEYSMITH_VERSION_H +#define KEYSMITH_VERSION_H + +#include + +#define KEYSMITH_VERSION_STRING (QStringLiteral("@keysmith_VERSION@")) + +#endif