Warning, /frameworks/kidletime/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(KIdleTime VERSION ${KF_VERSION}) 0005 0006 # ECM setup 0007 include(FeatureSummary) 0008 find_package(ECM 5.249.0 NO_MODULE) 0009 set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules") 0010 feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) 0011 0012 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) 0013 0014 include(KDEInstallDirs) 0015 include(KDECMakeSettings) 0016 include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) 0017 0018 include(KDEGitCommitHooks) 0019 include(CMakeFindFrameworks) 0020 include(CMakePackageConfigHelpers) 0021 include(ECMGenerateExportHeader) 0022 include(ECMQtDeclareLoggingCategory) 0023 include(ECMSetupVersion) 0024 include(ECMGenerateHeaders) 0025 include(ECMDeprecationSettings) 0026 include(ECMAddQch) 0027 0028 set(kiconthemes_version_header "${CMAKE_CURRENT_BINARY_DIR}/src/kidletime_version.h") 0029 ecm_setup_version(PROJECT VARIABLE_PREFIX KIDLETIME 0030 VERSION_HEADER "${kiconthemes_version_header}" 0031 PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF6IdleTimeConfigVersion.cmake" 0032 SOVERSION 6) 0033 0034 set(REQUIRED_QT_VERSION 6.5.0) 0035 find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Gui) 0036 0037 option(WITH_X11 "Build X11 support" ON) 0038 option(WITH_WAYLAND "BUILD Wayland support" ON) 0039 0040 if(APPLE OR WIN32) 0041 set(WITH_X11 OFF) 0042 set(WITH_WAYLAND OFF) 0043 endif() 0044 0045 if(APPLE) 0046 cmake_find_frameworks(CoreFoundation Carbon) 0047 endif() 0048 0049 if(WITH_X11) 0050 find_package(X11 REQUIRED) 0051 find_package(XCB REQUIRED COMPONENTS XCB SYNC) 0052 find_package(X11_XCB REQUIRED) 0053 set(HAVE_X11 TRUE) 0054 0055 if (X11_XSync_FOUND AND XCB_XCB_FOUND AND X11_XCB_FOUND AND XCB_SYNC_FOUND) 0056 # One cannot just use "set(HAVE_XSYNC X11_XSync_FOUND AND XCB_XCB_FOUND...)" 0057 # Doing so would create a list because the value passed to set() is not evaluated. 0058 set(HAVE_XSYNC TRUE) 0059 else() 0060 set(HAVE_XSYNC FALSE) 0061 endif() 0062 add_feature_info("libXext" X11_XSync_FOUND "required for X-Sync based poller") 0063 add_feature_info("libX11-xcb" X11_XCB_FOUND "required for X-Sync based poller") 0064 add_feature_info("libxcb" XCB_XCB_FOUND "required for X-Sync based poller") 0065 add_feature_info("libxcb-sync" XCB_SYNC_FOUND "required for X-Sync based poller") 0066 add_feature_info("X-Sync based poller" HAVE_XSYNC "efficient operation of KIdleTime. STRONGLY RECOMMENDED (requires libXext, libX11-xcb, libxcb and libxcb-sync)") 0067 0068 set(HAVE_XSCREENSAVER ${X11_Xscreensaver_FOUND}) 0069 add_feature_info("X-Screensaver based poller" HAVE_XSCREENSAVER "KIdleTime fallback mode (libXss)") 0070 0071 if(HAVE_XSCREENSAVER) 0072 find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED DBus) 0073 endif() 0074 0075 if(NOT HAVE_XSCREENSAVER AND NOT HAVE_XSYNC) 0076 message(FATAL_ERROR "\nNeither the XSync (libXext) nor XScreensaver (libXss) development package was found.\nPlease install one of them (XSync is recommended)") 0077 endif() 0078 else() 0079 set(HAVE_X11 FALSE) 0080 endif() 0081 0082 if(WITH_WAYLAND) 0083 find_package(Qt6Gui REQUIRED CONFIG COMPONENTS Private) 0084 find_package(Qt6WaylandClient ${REQUIRED_QT_VERSION} REQUIRED CONFIG) 0085 find_package(Wayland 1.9 REQUIRED Client) 0086 find_package(PlasmaWaylandProtocols 1.6.0 CONFIG REQUIRED) 0087 find_package(WaylandProtocols 1.27) 0088 set_package_properties(WaylandProtocols PROPERTIES 0089 TYPE REQUIRED 0090 PURPOSE "Collection of Wayland protocols that add functionality not available in the Wayland core protocol" 0091 URL "https://gitlab.freedesktop.org/wayland/wayland-protocols/" 0092 ) 0093 endif() 0094 0095 set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].") 0096 0097 option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF) 0098 add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)") 0099 0100 ecm_set_disabled_deprecation_versions( 0101 QT 6.5 0102 ) 0103 0104 # Subdirectories 0105 add_subdirectory(src) 0106 add_subdirectory(examples) 0107 0108 # create a Config.cmake and a ConfigVersion.cmake file and install them 0109 set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF6IdleTime") 0110 0111 if (BUILD_QCH) 0112 ecm_install_qch_export( 0113 TARGETS KF6IdleTime_QCH 0114 FILE KF6IdleTimeQchTargets.cmake 0115 DESTINATION "${CMAKECONFIG_INSTALL_DIR}" 0116 COMPONENT Devel 0117 ) 0118 set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF6IdleTimeQchTargets.cmake\")") 0119 endif() 0120 0121 configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KF6IdleTimeConfig.cmake.in" 0122 "${CMAKE_CURRENT_BINARY_DIR}/KF6IdleTimeConfig.cmake" 0123 INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} 0124 ) 0125 0126 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF6IdleTimeConfig.cmake" 0127 "${CMAKE_CURRENT_BINARY_DIR}/KF6IdleTimeConfigVersion.cmake" 0128 DESTINATION "${CMAKECONFIG_INSTALL_DIR}" 0129 COMPONENT Devel ) 0130 0131 install(EXPORT KF6IdleTimeTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF6IdleTimeTargets.cmake NAMESPACE KF6:: ) 0132 0133 install(FILES ${kiconthemes_version_header} 0134 DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/KIdleTime COMPONENT Devel) 0135 0136 include(ECMFeatureSummary) 0137 ecm_feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) 0138 0139 kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)