From 76c61c60bb683d6d93e761fc4ef9b2d3dbfde764 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Thu, 22 Oct 2020 14:41:30 +0200 Subject: [PATCH] CMake stuff --- CMakeLists.txt | 30 ++++++++++++++++++------------ src/CMakeLists.txt | 6 +++--- src/main.cpp | 4 ++-- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c41bd243..1e6e59b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,23 +1,26 @@ +cmake_minimum_required(VERSION 3.14) + project(Alligator) -cmake_minimum_required(VERSION 2.8.12) - -set(KF5_MIN_VERSION "5.70.0") -set(QT_MIN_VERSION "5.10.0") - -include(FeatureSummary) +set(KF5_MIN_VERSION "5.75.0") +set(QT_MIN_VERSION "5.15.0") find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) +set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) +include(FeatureSummary) include(ECMSetupVersion) -include(ECMGenerateHeaders) include(KDEInstallDirs) include(KDEClangFormat) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) +ecm_setup_version(0.1.0 + VARIABLE_PREFIX ALLIGATOR + VERSION_HEADER ${CMAKE_CURRENT_BINARY_DIR}/alligator-version.h +) + find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui QuickControls2 Sql) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons Syndication Config I18n) @@ -29,10 +32,13 @@ else() find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Widgets) endif() -add_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_URL_CAST_FROM_STRING) -add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT) -add_definitions(-DQT_USE_QSTRINGBUILDER) -add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050d00) +add_definitions(-DQT_NO_CAST_FROM_ASCII + -DQT_NO_CAST_TO_ASCII + -DQT_NO_URL_CAST_FROM_STRING + -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT + -DQT_USE_QSTRINGBUILDER + -DQT_DISABLE_DEPRECATED_BEFORE=0x050d00 +) install(PROGRAMS org.kde.alligator.desktop DESTINATION ${KDE_INSTALL_APPDIR}) install(FILES org.kde.alligator.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a46c6413..55930dd7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -set(alligator_SRCS +add_executable(alligator main.cpp feedsmodel.cpp entriesmodel.cpp @@ -10,9 +10,9 @@ set(alligator_SRCS resources.qrc ) -kconfig_add_kcfg_files(alligator_SRCS alligatorsettings.kcfgc GENERATE_MOC) +kconfig_add_kcfg_files(alligator alligatorsettings.kcfgc GENERATE_MOC) -add_executable(alligator ${alligator_SRCS}) +target_include_directories(alligator PRIVATE ${CMAKE_BINARY_DIR}) target_link_libraries(alligator PRIVATE Qt5::Core Qt5::Qml Qt5::Quick Qt5::QuickControls2 Qt5::Sql KF5::Syndication KF5::CoreAddons KF5::ConfigGui KF5::I18n) if(ANDROID) diff --git a/src/main.cpp b/src/main.cpp index c3ad352c..67443954 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,6 +21,7 @@ #include #include +#include "alligator-version.h" #include "alligatorsettings.h" #include "database.h" #include "entriesmodel.h" @@ -42,7 +43,6 @@ int main(int argc, char *argv[]) QCoreApplication::setOrganizationName(QStringLiteral("KDE")); QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org")); QCoreApplication::setApplicationName(QStringLiteral("Alligator")); - QCoreApplication::setApplicationVersion(QStringLiteral("0.1")); qmlRegisterType("org.kde.alligator", 1, 0, "FeedsModel"); qmlRegisterUncreatableType("org.kde.alligator", 1, 0, "EntriesModel", QStringLiteral("Get from Feed")); @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) QCommandLineParser parser; parser.setApplicationDescription(i18n("RSS/Atom Feed Reader")); - KAboutData about(QStringLiteral("alligator"), i18n("Alligator"), QStringLiteral("0.1"), i18n("Feed Reader"), KAboutLicense::GPL, i18n("© 2020 KDE Community")); + KAboutData about(QStringLiteral("alligator"), i18n("Alligator"), QStringLiteral(ALLIGATOR_VERSION_STRING), i18n("Feed Reader"), KAboutLicense::GPL, i18n("© 2020 KDE Community")); about.addAuthor(i18n("Tobias Fella"), QString(), QStringLiteral("fella@posteo.de")); KAboutData::setApplicationData(about);