CMake stuff

This commit is contained in:
Nicolas Fella 2020-10-22 14:41:30 +02:00
parent 613a40bcf1
commit 76c61c60bb
3 changed files with 23 additions and 17 deletions

View File

@ -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})

View File

@ -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)

View File

@ -21,6 +21,7 @@
#include <KLocalizedContext>
#include <KLocalizedString>
#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<FeedsModel>("org.kde.alligator", 1, 0, "FeedsModel");
qmlRegisterUncreatableType<EntriesModel>("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);