Warning, /maui/mauikit-filebrowsing/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.filebrowsing) 0043 0044 project(FileBrowsing 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 if(ANDROID OR APPLE OR WIN32) 0068 set(IS_KIO_AVAILABLE OFF) 0069 else() 0070 set(IS_KIO_AVAILABLE ON) 0071 endif() 0072 0073 option (KIO_AVAILABLE "Use KIO library if it is avalibale, otherwise use default fallack implementation" ${IS_KIO_AVAILABLE}) 0074 0075 option(QUICK_COMPILER "Use QtQuick compiler to improve performance" ON) 0076 0077 ##option to be removed in qt6 migration 0078 if (QT_MAJOR_VERSION STREQUAL "5") 0079 option(QUICK_COMPILER ON) 0080 if(ANDROID OR WIN32 OR APPLE) 0081 set(QUICK_COMPILER ON) 0082 set(BUNDLE_LUV_ICONS ON) 0083 endif() 0084 else() 0085 option(QUICK_COMPILER OFF) 0086 endif() 0087 0088 find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS 0089 Core 0090 Quick 0091 Sql 0092 Xml 0093 Concurrent 0094 Network) 0095 0096 find_package(KF${KF_MAJOR_VERSION} ${REQUIRED_KF_VERSION} REQUIRED COMPONENTS 0097 I18n 0098 CoreAddons) 0099 0100 find_package(MauiKit${MAUI_MAJOR_VERSION} ${MAUIKIT_VERSION} REQUIRED) 0101 0102 if(ANDROID) 0103 find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS AndroidExtras) 0104 find_package(Gradle REQUIRED) 0105 endif() 0106 0107 if(${KIO_AVAILABLE}) 0108 find_package(KF${KF_MAJOR_VERSION} ${REQUIRED_KF_VERSION} REQUIRED COMPONENTS KIO) 0109 endif() 0110 0111 if (QT_MAJOR_VERSION STREQUAL "5") 0112 if(QUICK_COMPILER) 0113 find_package(Qt5QuickCompiler) 0114 set_package_properties(Qt5QuickCompiler PROPERTIES 0115 DESCRIPTION "Compile QML at build time" 0116 TYPE OPTIONAL) 0117 endif() 0118 endif() 0119 0120 if(${ECM_SOURCE_UNDER_VERSION_CONTROL}) 0121 execute_process( 0122 COMMAND git rev-parse --abbrev-ref HEAD 0123 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} 0124 OUTPUT_VARIABLE GIT_BRANCH 0125 OUTPUT_STRIP_TRAILING_WHITESPACE) 0126 0127 # Get the latest abbreviated commit hash of the working branch 0128 execute_process( 0129 COMMAND git log -1 --format=%h 0130 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} 0131 OUTPUT_VARIABLE GIT_COMMIT_HASH 0132 OUTPUT_STRIP_TRAILING_WHITESPACE) 0133 0134 add_definitions(-DGIT_COMMIT_HASH="${GIT_COMMIT_HASH}") 0135 add_definitions(-DGIT_BRANCH="${GIT_BRANCH}") 0136 0137 else() 0138 add_definitions(-DGIT_COMMIT_HASH="${PROJECT_VERSION}") 0139 add_definitions(-DGIT_BRANCH="Stable") 0140 endif() 0141 0142 ##CMAKE PARTS 0143 set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/MauiKitFileBrowsing${MAUI_MAJOR_VERSION}") 0144 0145 ecm_setup_version(${PROJECT_VERSION} 0146 VARIABLE_PREFIX FileBrowsing 0147 VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/filebrowsing_version.h" 0148 PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/MauiKitFileBrowsing${MAUI_MAJOR_VERSION}ConfigVersion.cmake" 0149 SOVERSION ${PROJECT_VERSION_MAJOR}) 0150 0151 configure_package_config_file( 0152 "${CMAKE_CURRENT_SOURCE_DIR}/MauiKitFileBrowsingConfig.cmake.in.${QT_MAJOR_VERSION}" 0153 "${CMAKE_CURRENT_BINARY_DIR}/MauiKitFileBrowsing${MAUI_MAJOR_VERSION}Config.cmake" 0154 INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} 0155 PATH_VARS CMAKE_INSTALL_PREFIX) 0156 0157 install(FILES 0158 "${CMAKE_CURRENT_BINARY_DIR}/MauiKitFileBrowsing${MAUI_MAJOR_VERSION}ConfigVersion.cmake" 0159 "${CMAKE_CURRENT_BINARY_DIR}/MauiKitFileBrowsing${MAUI_MAJOR_VERSION}Config.cmake" 0160 DESTINATION "${CMAKECONFIG_INSTALL_DIR}" 0161 COMPONENT Devel) 0162 0163 install(EXPORT MauiKitFileBrowsing${MAUI_MAJOR_VERSION}Targets 0164 DESTINATION "${CMAKECONFIG_INSTALL_DIR}" 0165 FILE MauiKitFileBrowsing${MAUI_MAJOR_VERSION}Targets.cmake 0166 NAMESPACE MauiKit${MAUI_MAJOR_VERSION}::) 0167 0168 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/filebrowsing_version.h" 0169 DESTINATION ${KDE_INSTALL_INCLUDEDIR}/MauiKit${MAUI_MAJOR_VERSION}/FileBrowsing 0170 COMPONENT Devel) 0171 0172 add_definitions(-DTRANSLATION_DOMAIN="mauikitfilebrowsing") 0173 if(${QT_MAJOR_VERSION} STREQUAL 5) ##for now skip installing translations for mauikit4 to avoid packaging conflicts with translation files 0174 ki18n_install(po) 0175 endif() 0176 0177 add_subdirectory(src) 0178 0179 file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h) 0180 kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) 0181 0182 feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)