kasts/CMakeLists.txt

95 lines
3.1 KiB
CMake
Raw Normal View History

2021-04-06 17:04:17 +02:00
# SPDX-FileCopyrightText: 2020 Tobias Fella <fella@posteo.de>
# SPDX-FileCopyrightText: 2020 Nicolas Fella <nicolas.fella@gmx.de>
# SPDX-License-Identifier: BSD-2-Clause
cmake_minimum_required(VERSION 3.16)
2020-02-28 23:25:08 +01:00
2021-05-03 22:16:19 +02:00
project(Kasts)
set(PROJECT_VERSION "22.02")
# be c++17 compliant
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(KF5_MIN_VERSION "5.89.0")
2020-10-22 14:41:30 +02:00
set(QT_MIN_VERSION "5.15.0")
2020-02-28 23:25:08 +01:00
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
2020-02-28 23:25:08 +01:00
2020-10-22 14:41:30 +02:00
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
2020-02-28 23:25:08 +01:00
2020-10-22 14:41:30 +02:00
include(FeatureSummary)
2020-02-28 23:25:08 +01:00
include(ECMSetupVersion)
2021-05-28 22:55:18 +02:00
include(ECMQtDeclareLoggingCategory)
include(ECMGenerateExportHeader)
2020-02-28 23:25:08 +01:00
include(KDEInstallDirs)
2021-06-19 13:39:49 +02:00
include(KDEGitCommitHooks)
2020-02-28 23:25:08 +01:00
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
if(NOT ANDROID)
include(KDEClangFormat)
endif()
2021-05-28 22:55:18 +02:00
2021-05-27 23:19:21 +02:00
ecm_setup_version(${PROJECT_VERSION}
2021-05-03 22:16:19 +02:00
VARIABLE_PREFIX KASTS
VERSION_HEADER ${CMAKE_CURRENT_BINARY_DIR}/kasts-version.h
2020-10-22 14:41:30 +02:00
)
2021-02-21 19:54:10 +01:00
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui QuickControls2 Sql Multimedia)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons Syndication Config I18n)
find_package(Taglib REQUIRED)
2021-10-29 17:00:52 +02:00
find_package(Qt5Keychain)
set_package_properties(Qt5Keychain PROPERTIES
TYPE REQUIRED
PURPOSE "Secure storage of account secrets"
)
2020-02-28 23:25:08 +01:00
find_package(KF5 ${KF5_MIN_VERSION} OPTIONAL_COMPONENTS NetworkManagerQt)
2020-04-21 23:27:15 +02:00
if (ANDROID)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Svg AndroidExtras)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Kirigami2)
2020-04-28 21:32:24 +02:00
find_package(OpenSSL REQUIRED)
2021-10-07 01:48:10 +02:00
find_package(SQLite3)
find_package(ZLIB)
find_package(Gradle)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/android/version.gradle.in ${CMAKE_BINARY_DIR}/version.gradle)
2020-04-21 23:27:15 +02:00
else()
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Widgets DBus)
2020-04-21 23:27:15 +02:00
endif()
2021-08-05 01:56:49 +02:00
if (ANDROID)
find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG QUIET OPTIONAL_COMPONENTS AndroidExtras)
set_package_properties(Qt5AndroidExtras PROPERTIES
DESCRIPTION "Qt5 AndroidExtras is needed to provide the Android integration."
TYPE REQUIRED)
endif()
2020-10-22 14:41:30 +02:00
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
)
2020-04-21 23:27:15 +02:00
2021-08-05 01:56:49 +02:00
2021-05-03 22:16:19 +02:00
install(PROGRAMS org.kde.kasts.desktop DESTINATION ${KDE_INSTALL_APPDIR})
install(FILES org.kde.kasts.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
install(FILES kasts.svg DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/hicolor/scalable/apps)
2020-02-28 23:25:08 +01:00
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/android/version.gradle.in ${CMAKE_BINARY_DIR}/version.gradle)
2020-02-28 23:25:08 +01:00
add_subdirectory(src)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
2020-04-21 23:27:15 +02:00
if (NOT ANDROID)
# inside if-statement to work around problems with gitlab Android CI
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES src/*.cpp src/*.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
endif()