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 "6.0.0") # handled by release scripts
0004 project(Solid VERSION ${KF_VERSION})
0005 
0006 include(FeatureSummary)
0007 find_package(ECM 5.249.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 6.5.0)
0023 find_package(Qt6 ${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(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED DBus)
0028 endif()
0029 
0030 if(WIN32)
0031     find_package(Qt6 ${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 set(solid_version_header "${CMAKE_CURRENT_BINARY_DIR}/src/solid/solid_version.h")
0083 ecm_setup_version(PROJECT VARIABLE_PREFIX SOLID
0084                         VERSION_HEADER "${solid_version_header}"
0085                         PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF6SolidConfigVersion.cmake"
0086                         SOVERSION 6)
0087 
0088 # TODO: Remove these
0089 remove_definitions(-DQT_NO_CAST_FROM_ASCII)
0090 remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
0091 
0092 ecm_set_disabled_deprecation_versions(
0093     QT 6.5
0094 )
0095 
0096 ecm_install_po_files_as_qm(poqm)
0097 
0098 option(WITH_NEW_SOLID_JOB "WIP: base Job class" Off)
0099 add_feature_info(Solid::Job WITH_NEW_SOLID_JOB "WIP: Base class for Solid Asynchronous apis")
0100 
0101 option(WITH_NEW_POWER_ASYNC_API "WIP: Asynchronous API for power management" Off)
0102 add_feature_info(Solid::PowerManagement WITH_NEW_POWER_ASYNC_API "WIP: Asynchronous API for power management")
0103 
0104 option(WITH_NEW_POWER_ASYNC_FREEDESKTOP "WIP: Freedesktop backend for the asynchronous api" Off)
0105 add_feature_info(Solid::PowerManagement WITH_NEW_POWER_ASYNC_FREEDESKTOP "WIP: Freedesktop backend for the asynchronous api")
0106 
0107 include(SolidBackendsMacros)
0108 
0109 add_device_backends_begin()
0110 add_device_backend(fakehw)
0111 if (CMAKE_SYSTEM_NAME MATCHES Linux)
0112     option(UDEV_DISABLED "Allows disabling UDev usage on Linux builds" OFF)
0113     if (NOT UDEV_DISABLED)
0114         find_package(UDev REQUIRED)
0115         set_package_properties(UDev PROPERTIES
0116             TYPE REQUIRED
0117             PURPOSE "Allows Solid to use UDev to provide information about devices on Linux"
0118         )
0119     endif()
0120     if (UDev_FOUND)
0121         set(UDEV_FOUND TRUE) # for config-solid.h
0122         add_device_backend(udev)
0123     endif()
0124     set(HAVE_LIBMOUNT ${LibMount_FOUND})
0125     add_device_backend(udisks2)
0126     add_device_backend(fstab)
0127     add_device_backend(upower)
0128 elseif (APPLE)
0129     find_package(IOKit REQUIRED)
0130     add_device_backend(iokit)
0131 elseif (WIN32)
0132     add_device_backend(win)
0133 elseif (NOT ANDROID)
0134     add_device_backend(upower)
0135     add_device_backend(fstab)
0136 
0137     if (CMAKE_SYSTEM_NAME MATCHES FreeBSD OR CMAKE_SYSTEM_NAME MATCHES OpenBSD)
0138         add_device_backend(udisks2)
0139     endif()
0140 endif()
0141 
0142 if(IMobileDevice_FOUND AND PList_FOUND)
0143     add_device_backend(imobile)
0144 endif()
0145 
0146 add_device_backends_cmake()
0147 
0148 add_subdirectory(src)
0149 if (BUILD_TESTING)
0150     add_subdirectory(autotests)
0151 endif()
0152 
0153 # create a Config.cmake and a ConfigVersion.cmake file and install them
0154 set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF6Solid")
0155 
0156 if (BUILD_QCH)
0157     ecm_install_qch_export(
0158         TARGETS KF6Solid_QCH
0159         FILE KF6SolidQchTargets.cmake
0160         DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0161         COMPONENT Devel
0162     )
0163     set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF6SolidQchTargets.cmake\")")
0164 endif()
0165 
0166 configure_package_config_file(
0167     "${CMAKE_CURRENT_SOURCE_DIR}/KF6SolidConfig.cmake.in"
0168     "${CMAKE_CURRENT_BINARY_DIR}/KF6SolidConfig.cmake"
0169     PATH_VARS KDE_INSTALL_DBUSINTERFACEDIR
0170     INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
0171 )
0172 
0173 install(FILES  "${CMAKE_CURRENT_BINARY_DIR}/KF6SolidConfig.cmake"
0174                "${CMAKE_CURRENT_BINARY_DIR}/KF6SolidConfigVersion.cmake"
0175         DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0176         COMPONENT Devel )
0177 
0178 install(EXPORT KF6SolidTargets  DESTINATION "${CMAKECONFIG_INSTALL_DIR}"  FILE KF6SolidTargets.cmake  NAMESPACE KF6:: )
0179 
0180 install(FILES ${solid_version_header}
0181         DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/Solid COMPONENT Devel
0182 )
0183 
0184 include(ECMFeatureSummary)
0185 ecm_feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
0186 
0187 kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)