Added version number and optional build number to build system

This commit is contained in:
mandlm 2019-01-30 21:23:26 +01:00
parent f3249b8720
commit eff3b42cb0
4 changed files with 31 additions and 5 deletions

View File

@ -5,7 +5,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(cmake/conan.cmake)
conan_cmake_run(CONANFILE conanfile.txt
BASIC_SETUP
BUILD missing)
BUILD missing
)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

View File

@ -1,6 +1,24 @@
cmake_minimum_required(VERSION 3.6)
project(ESGRAF48 LANGUAGES CXX)
set(BUILD_VERSION_MAJOR_MINOR 0.1)
if ($ENV{BUILD_NUMBER})
set(BUILD_VERSION_PATCH $ENV{BUILD_NUMBER})
else()
set(BUILD_VERSION_PATCH 0)
endif()
project(ESGRAF48
VERSION ${BUILD_VERSION_MAJOR_MINOR}.${BUILD_VERSION_PATCH}
DESCRIPTION "ESGRAF 4-8"
LANGUAGES CXX
)
configure_file(
version.h.in
version.h
)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5PrintSupport REQUIRED)

View File

@ -1,15 +1,18 @@
#include "mainwindow.h"
#include "version.h"
#include <QApplication>
#include <QCommandLineParser>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QCoreApplication::setApplicationName("ESGRAF 4-8");
QCoreApplication::setApplicationVersion("0.1");
QCoreApplication::setApplicationName(ESGRAF48_DESCRIPTION);
QCoreApplication::setApplicationVersion(ESGRAF48_VERSION);
QCommandLineParser cmdParser;
cmdParser.setApplicationDescription("ESGRAF 4-8");
cmdParser.setApplicationDescription(ESGRAF48_DESCRIPTION);
cmdParser.addHelpOption();
cmdParser.addVersionOption();
cmdParser.addPositionalArgument("filename", "file to open");

4
source/version.h.in Normal file
View File

@ -0,0 +1,4 @@
#pragma once
#define ESGRAF48_VERSION "@PROJECT_VERSION@"
#define ESGRAF48_DESCRIPTION "@PROJECT_DESCRIPTION@"