From 6920e0c123b40646f80c0dd2074f7a3fdf37794c Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Thu, 31 Aug 2023 13:34:02 +0200 Subject: [PATCH] Add ECM, ki18n dependency, and configure clang format automatically --- CMakeLists.txt | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c0bb96..31e690b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,19 +2,37 @@ # SPDX-License-Identifier: CC0-1.0 cmake_minimum_required(VERSION 3.25) -project(Redai) +project(Redai VERSION 0.1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -find_package(Qt5 COMPONENTS +set(QT_MIN_VERSION 5.15) +set(KF5_MIN_VERSION 5.83) + +find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) +list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) + +include(KDEInstallDirs) +include(ECMFindQmlModule) +include(KDECMakeSettings) +include(KDECompilerSettings NO_POLICY_SCOPE) +include(ECMSetupVersion) +include(ECMGenerateHeaders) +include(ECMPoQmTools) +include(KDEGitCommitHooks) +include(KDEClangFormat) + +find_package(Qt5 ${QT_MIN_VERSION} NO_MODULE REQUIRED COMPONENTS Core Gui Widgets - Concurrent - REQUIRED) + Concurrent) +find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS I18n) add_executable(Redai) target_sources(Redai PRIVATE @@ -34,5 +52,11 @@ target_link_libraries(Redai Qt5::Gui Qt5::Widgets Qt5::Concurrent - ) + KF5::I18n) +feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) + +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) \ No newline at end of file