Skip to content

Commit

Permalink
Versioning with cmake.
Browse files Browse the repository at this point in the history
  • Loading branch information
William committed Aug 14, 2022
1 parent 1afe3c9 commit 38afe19
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 3.16)
project(Koi VERSION 0.1.5 LANGUAGES CXX)

configure_file(headers/config.h.in config.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOMOC ON)
Expand Down Expand Up @@ -34,6 +37,7 @@ add_executable(Koi

about.cpp headers/about.h
colorscheme.cpp headers/colorscheme.h
headers/config.h.in
gtk.cpp headers/gtk.h
icons.cpp headers/icons.h
kvantumstyle.cpp headers/kvantumstyle.h
Expand Down
5 changes: 3 additions & 2 deletions src/about.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "headers/about.h"
#include "ui/ui_about.h"
#include "config.h"

#include <QUrl>
#include <QDesktopServices>
Expand All @@ -10,10 +11,10 @@ About::About(QWidget *parent) :
{
ui->setupUi(this);
this->setFixedSize(505, 330);
QApplication::setApplicationName("Koi");
QApplication::setApplicationName(PROJECT_NAME);
ui->titleLabel->setText(QApplication::applicationName());
QString pgrmVersion = "Version ";
QApplication::setApplicationVersion("0.1.3");
QApplication::setApplicationVersion(PROJECT_VER);
ui->verLabel->setText(pgrmVersion + QApplication::applicationVersion());
QString qtVersion = "<ul><li>Qt ";
qtVersion += qVersion();
Expand Down
1 change: 1 addition & 0 deletions src/headers/about.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define ABOUT_H
// Headers
#include "license.h"
#include "config.h"
// Qt libs
#include <QDialog>
//KF5 libs
Expand Down
10 changes: 10 additions & 0 deletions src/headers/config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef INCLUDE_GUARD
#define INCLUDE_GUARD

#define PROJECT_NAME "@PROJECT_NAME@"
#define PROJECT_VER "@PROJECT_VERSION@"
#define PROJECT_VER_MAJOR "@PROJECT_VERSION_MAJOR@"
#define PROJECT_VER_MINOR "@PROJECT_VERSION_MINOR@"
#define PTOJECT_VER_PATCH "@PROJECT_VERSION_PATCH@"

#endif // INCLUDE_GUARD

0 comments on commit 38afe19

Please sign in to comment.