Warning, /frameworks/solid/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 cmake_minimum_required(VERSION 3.16) 0002 0003 set(KF_VERSION "5.116.0") # handled by release scripts 0004 project(Solid VERSION ${KF_VERSION}) 0005 0006 include(FeatureSummary) 0007 find_package(ECM 5.115.0 NO_MODULE) 0008 set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules") 0009 feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) 0010 0011 0012 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) 0013 0014 include(KDEInstallDirs) 0015 include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) 0016 include(KDECMakeSettings) 0017 0018 include(KDEGitCommitHooks) 0019 include(ECMQtDeclareLoggingCategory) 0020 include(ECMDeprecationSettings) 0021 0022 set(REQUIRED_QT_VERSION 5.15.2) 0023 find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} CONFIG REQUIRED Xml Gui) 0024 0025 # Android has no DBus, and Windows & Mac have backends that don't use DBus 0026 if(NOT ANDROID AND NOT WIN32 AND NOT APPLE) 0027 find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} CONFIG REQUIRED DBus) 0028 endif() 0029 0030 if(WIN32) 0031 find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} CONFIG REQUIRED Network) 0032 endif() 0033 0034 0035 include(ECMGenerateExportHeader) 0036 include(CMakePackageConfigHelpers) 0037 include(ECMSetupVersion) 0038 include(ECMGenerateHeaders) 0039 include(ECMMarkNonGuiExecutable) 0040 include(ECMAddQch) 0041 0042 find_package(FLEX REQUIRED) 0043 set_package_properties(FLEX PROPERTIES 0044 URL "http://flex.sourceforge.net" 0045 DESCRIPTION "Fast Lexical Analyzer" 0046 TYPE REQUIRED 0047 PURPOSE "Required for the Predicate parser" 0048 ) 0049 0050 find_package(BISON 3.0 REQUIRED) 0051 set_package_properties(BISON PROPERTIES 0052 URL "http://www.gnu.org/software/bison" 0053 DESCRIPTION "general-purpose parser generator" 0054 TYPE REQUIRED 0055 PURPOSE "Required for the Predicate parser" 0056 ) 0057 0058 find_package(IMobileDevice) 0059 set_package_properties(IMobileDevice PROPERTIES 0060 TYPE OPTIONAL 0061 PURPOSE "Needed to build the iOS device support backend" 0062 ) 0063 0064 find_package(PList) 0065 set_package_properties(PList PROPERTIES 0066 TYPE OPTIONAL 0067 PURPOSE "Needed to build the iOS device support backend" 0068 ) 0069 0070 # Used by the UDisks backend on Linux 0071 find_package(LibMount) 0072 set_package_properties(LibMount PROPERTIES 0073 TYPE OPTIONAL) 0074 0075 include(ECMPoQmTools) 0076 0077 set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].") 0078 0079 option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF) 0080 add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)") 0081 0082 ecm_setup_version(PROJECT VARIABLE_PREFIX SOLID 0083 VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/solid_version.h" 0084 PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5SolidConfigVersion.cmake" 0085 SOVERSION 5) 0086 0087 # TODO: Remove these 0088 remove_definitions(-DQT_NO_CAST_FROM_ASCII) 0089 remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY) 0090 0091 ecm_set_disabled_deprecation_versions( 0092 QT 5.15.2 0093 ) 0094 0095 ecm_install_po_files_as_qm(poqm) 0096 0097 option(WITH_NEW_SOLID_JOB "WIP: base Job class" Off) 0098 add_feature_info(Solid::Job WITH_NEW_SOLID_JOB "WIP: Base class for Solid Asynchronous apis") 0099 0100 option(WITH_NEW_POWER_ASYNC_API "WIP: Asynchronous API for power management" Off) 0101 add_feature_info(Solid::PowerManagement WITH_NEW_POWER_ASYNC_API "WIP: Asynchronous API for power management") 0102 0103 option(WITH_NEW_POWER_ASYNC_FREEDESKTOP "WIP: Freedesktop backend for the asynchronous api" Off) 0104 add_feature_info(Solid::PowerManagement WITH_NEW_POWER_ASYNC_FREEDESKTOP "WIP: Freedesktop backend for the asynchronous api") 0105 0106 include(SolidBackendsMacros) 0107 0108 add_device_backends_begin() 0109 add_device_backend(fakehw) 0110 if (CMAKE_SYSTEM_NAME MATCHES Linux) 0111 option(UDEV_DISABLED "Allows disabling UDev usage on Linux builds" OFF) 0112 if (NOT UDEV_DISABLED) 0113 find_package(UDev REQUIRED) 0114 set_package_properties(UDev PROPERTIES 0115 TYPE REQUIRED 0116 PURPOSE "Allows Solid to use UDev to provide information about devices on Linux" 0117 ) 0118 endif() 0119 if (UDev_FOUND) 0120 set(UDEV_FOUND TRUE) # for config-solid.h 0121 add_device_backend(udev) 0122 endif() 0123 set(HAVE_LIBMOUNT ${LibMount_FOUND}) 0124 add_device_backend(udisks2) 0125 add_device_backend(fstab) 0126 add_device_backend(upower) 0127 elseif (APPLE) 0128 find_package(IOKit REQUIRED) 0129 add_device_backend(iokit) 0130 elseif (WIN32) 0131 add_device_backend(win) 0132 elseif (NOT ANDROID) 0133 add_device_backend(upower) 0134 add_device_backend(fstab) 0135 0136 if (CMAKE_SYSTEM_NAME MATCHES FreeBSD OR CMAKE_SYSTEM_NAME MATCHES OpenBSD) 0137 add_device_backend(udisks2) 0138 endif() 0139 endif() 0140 0141 if(IMobileDevice_FOUND AND PList_FOUND) 0142 add_device_backend(imobile) 0143 endif() 0144 0145 add_device_backends_cmake() 0146 0147 add_subdirectory(src) 0148 if (BUILD_TESTING) 0149 add_subdirectory(autotests) 0150 endif() 0151 0152 # create a Config.cmake and a ConfigVersion.cmake file and install them 0153 set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Solid") 0154 0155 if (BUILD_QCH) 0156 ecm_install_qch_export( 0157 TARGETS KF5Solid_QCH 0158 FILE KF5SolidQchTargets.cmake 0159 DESTINATION "${CMAKECONFIG_INSTALL_DIR}" 0160 COMPONENT Devel 0161 ) 0162 set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF5SolidQchTargets.cmake\")") 0163 endif() 0164 0165 configure_package_config_file( 0166 "${CMAKE_CURRENT_SOURCE_DIR}/KF5SolidConfig.cmake.in" 0167 "${CMAKE_CURRENT_BINARY_DIR}/KF5SolidConfig.cmake" 0168 PATH_VARS KDE_INSTALL_DBUSINTERFACEDIR 0169 INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} 0170 ) 0171 0172 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF5SolidConfig.cmake" 0173 "${CMAKE_CURRENT_BINARY_DIR}/KF5SolidConfigVersion.cmake" 0174 DESTINATION "${CMAKECONFIG_INSTALL_DIR}" 0175 COMPONENT Devel ) 0176 0177 install(EXPORT KF5SolidTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5SolidTargets.cmake NAMESPACE KF5:: ) 0178 0179 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/solid_version.h 0180 DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/Solid COMPONENT Devel 0181 ) 0182 0183 feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) 0184 0185 kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)