Warning, /maui/mauikit-accounts/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: 2020 Camilo Higuita <milo.h@aol.com> 0002 # 0003 # SPDX-License-Identifier: GPL-3.0-or-later 0004 0005 cmake_minimum_required(VERSION 3.16) 0006 0007 option(BUILD_WITH_QT5 "Use Qt 5" OFF) 0008 option(BUILD_WITH_QT6 "Use Qt 6" OFF) 0009 0010 if(BUILD_WITH_QT5) 0011 set(QT_MAJOR_VERSION 5) 0012 elseif(BUILD_WITH_QT6) 0013 set(QT_MAJOR_VERSION 6) 0014 else() 0015 set(QT_MAJOR_VERSION 5) 0016 endif() 0017 0018 if (QT_MAJOR_VERSION STREQUAL "6") 0019 set(REQUIRED_QT_VERSION 6.4) 0020 set(REQUIRED_KF_VERSION 5.240.0) 0021 set(KF_MAJOR_VERSION 6) 0022 set(MAUI_MAJOR_VERSION 4) 0023 0024 set(MAUIKIT_VERSION 4.0.0) 0025 0026 else() 0027 set(REQUIRED_QT_VERSION 5.15.2) 0028 set(REQUIRED_KF_VERSION 5.95.0) 0029 set(KF_MAJOR_VERSION 5) 0030 set(MAUI_MAJOR_VERSION 3) 0031 0032 set(MAUIKIT_VERSION 3.1.0) 0033 endif() 0034 0035 set(CMAKE_CXX_STANDARD 17) 0036 set(CMAKE_CXX_STANDARD_REQUIRED ON) 0037 0038 set(CMAKE_INCLUDE_CURRENT_DIR ON) 0039 set(CMAKE_AUTOMOC ON) 0040 set(CMAKE_AUTORCC ON) 0041 0042 set(AUTOMOC_MOC_OPTIONS -Muri=org.mauikit.accounts) 0043 0044 project(Accounts LANGUAGES CXX VERSION ${MAUIKIT_VERSION}) 0045 0046 find_package(ECM ${REQUIRED_KF_VERSION} NO_MODULE) 0047 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}) 0048 0049 include(GenerateExportHeader) 0050 include(GNUInstallDirs) 0051 include(FeatureSummary) 0052 include(CMakePackageConfigHelpers) 0053 0054 include(KDEInstallDirs) 0055 include(KDECMakeSettings) 0056 include(KDECompilerSettings) 0057 include(KDEPackageAppTemplates) 0058 include(KDEClangFormat) 0059 0060 include(ECMSetupVersion) 0061 include(ECMGenerateQmlTypes) 0062 include(ECMGenerateHeaders) 0063 include(ECMFindQmlModule) 0064 include(ECMQmlModule) 0065 include(ECMSourceVersionControl) 0066 0067 option(QUICK_COMPILER "Use QtQuick compiler to improve performance" TRUE) 0068 0069 if(ANDROID) 0070 find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS AndroidExtras) 0071 find_package(Gradle REQUIRED) 0072 endif() 0073 0074 find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS 0075 Core 0076 Quick 0077 Sql 0078 Network ) 0079 0080 find_package(KF${KF_MAJOR_VERSION} ${REQUIRED_KF_VERSION} REQUIRED COMPONENTS 0081 I18n 0082 CoreAddons) 0083 0084 find_package(MauiKit${MAUI_MAJOR_VERSION} ${MAUIKIT_VERSION} REQUIRED) 0085 0086 if (QT_MAJOR_VERSION STREQUAL "5") 0087 if(QUICK_COMPILER) 0088 find_package(Qt5QuickCompiler) 0089 set_package_properties(Qt5QuickCompiler PROPERTIES 0090 DESCRIPTION "Compile QML at build time" 0091 TYPE OPTIONAL) 0092 endif() 0093 endif() 0094 0095 if(${ECM_SOURCE_UNDER_VERSION_CONTROL}) 0096 execute_process( 0097 COMMAND git rev-parse --abbrev-ref HEAD 0098 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} 0099 OUTPUT_VARIABLE GIT_BRANCH 0100 OUTPUT_STRIP_TRAILING_WHITESPACE) 0101 0102 # Get the latest abbreviated commit hash of the working branch 0103 execute_process( 0104 COMMAND git log -1 --format=%h 0105 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} 0106 OUTPUT_VARIABLE GIT_COMMIT_HASH 0107 OUTPUT_STRIP_TRAILING_WHITESPACE) 0108 0109 add_definitions(-DGIT_COMMIT_HASH="${GIT_COMMIT_HASH}") 0110 add_definitions(-DGIT_BRANCH="${GIT_BRANCH}") 0111 0112 else() 0113 add_definitions(-DGIT_COMMIT_HASH="${PROJECT_VERSION}") 0114 add_definitions(-DGIT_BRANCH="Stable") 0115 endif() 0116 0117 set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/MauiKitAccounts${MAUI_MAJOR_VERSION}") 0118 0119 ecm_setup_version(${PROJECT_VERSION} 0120 VARIABLE_PREFIX Accounts 0121 VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/accounts_version.h" 0122 PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/MauiKitAccounts${MAUI_MAJOR_VERSION}ConfigVersion.cmake" 0123 SOVERSION ${PROJECT_VERSION_MAJOR}) 0124 0125 configure_package_config_file( 0126 "${CMAKE_CURRENT_SOURCE_DIR}/MauiKitAccountsConfig.cmake.in.${QT_MAJOR_VERSION}" 0127 "${CMAKE_CURRENT_BINARY_DIR}/MauiKitAccounts${MAUI_MAJOR_VERSION}Config.cmake" 0128 INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} 0129 PATH_VARS CMAKE_INSTALL_PREFIX) 0130 0131 install(FILES 0132 "${CMAKE_CURRENT_BINARY_DIR}/MauiKitAccounts${MAUI_MAJOR_VERSION}ConfigVersion.cmake" 0133 "${CMAKE_CURRENT_BINARY_DIR}/MauiKitAccounts${MAUI_MAJOR_VERSION}Config.cmake" 0134 DESTINATION "${CMAKECONFIG_INSTALL_DIR}" 0135 COMPONENT Devel) 0136 0137 install(EXPORT MauiKitAccounts${MAUI_MAJOR_VERSION}Targets 0138 DESTINATION "${CMAKECONFIG_INSTALL_DIR}" 0139 FILE MauiKitAccounts${MAUI_MAJOR_VERSION}Targets.cmake 0140 NAMESPACE MauiKit${MAUI_MAJOR_VERSION}::) 0141 0142 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/accounts_version.h" 0143 DESTINATION ${KDE_INSTALL_INCLUDEDIR}/MauiKit${MAUI_MAJOR_VERSION}/Accounts 0144 COMPONENT Devel) 0145 0146 add_definitions(-DTRANSLATION_DOMAIN="mauikitaccounts") 0147 if(${QT_MAJOR_VERSION} STREQUAL 5) ##for now skip installing translations for mauikit4 to avoid packaging conflicts with translation files 0148 ki18n_install(po) 0149 endif() 0150 0151 add_subdirectory(src) 0152 0153 file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h) 0154 kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) 0155 0156 feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)