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 "5.116.0") # handled by release scripts
0004 project(KIdleTime VERSION ${KF_VERSION})
0005 
0006 # ECM setup
0007 include(FeatureSummary)
0008 find_package(ECM 5.115.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 ecm_setup_version(PROJECT VARIABLE_PREFIX KIDLETIME
0029                         VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kidletime_version.h"
0030                         PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5IdleTimeConfigVersion.cmake"
0031                         SOVERSION 5)
0032 
0033 set(REQUIRED_QT_VERSION 5.15.2)
0034 find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} CONFIG REQUIRED Gui)
0035 
0036 if(APPLE)
0037     cmake_find_frameworks(CoreFoundation Carbon)
0038 endif()
0039 
0040 if(NOT APPLE)
0041     find_package(X11)
0042     find_package(XCB COMPONENTS XCB)
0043     find_package(Qt${QT_MAJOR_VERSION}WaylandClient ${REQUIRED_QT_VERSION} CONFIG)
0044 endif()
0045 
0046 if(X11_FOUND)
0047     if (QT_MAJOR_VERSION STREQUAL "5")
0048         find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED X11Extras)
0049     endif()
0050     find_package(XCB COMPONENTS XCB SYNC)
0051     find_package(X11_XCB)
0052     set(HAVE_X11 TRUE)
0053     if (X11_XSync_FOUND AND XCB_XCB_FOUND AND X11_XCB_FOUND AND XCB_SYNC_FOUND)
0054         # One cannot just use "set(HAVE_XSYNC X11_XSync_FOUND AND XCB_XCB_FOUND...)"
0055         # Doing so would create a list because the value passed to set() is not evaluated.
0056         set(HAVE_XSYNC TRUE)
0057     else()
0058         set(HAVE_XSYNC FALSE)
0059     endif()
0060     add_feature_info("libXext" X11_XSync_FOUND "required for X-Sync based poller")
0061     add_feature_info("libX11-xcb" X11_XCB_FOUND "required for X-Sync based poller")
0062     add_feature_info("libxcb" XCB_XCB_FOUND "required for X-Sync based poller")
0063     add_feature_info("libxcb-sync" XCB_SYNC_FOUND "required for X-Sync based poller")
0064     add_feature_info("X-Sync based poller" HAVE_XSYNC "efficient operation of KIdleTime. STRONGLY RECOMMENDED (requires libXext, libX11-xcb, libxcb and libxcb-sync)")
0065 
0066     set(HAVE_XSCREENSAVER ${X11_Xscreensaver_FOUND})
0067     add_feature_info("X-Screensaver based poller" HAVE_XSCREENSAVER "KIdleTime fallback mode (libXss)")
0068 
0069     if(HAVE_XSCREENSAVER AND NOT WIN32)
0070         find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} CONFIG REQUIRED DBus)
0071     endif()
0072 
0073     if(NOT HAVE_XSCREENSAVER AND NOT HAVE_XSYNC)
0074         message(FATAL_ERROR "\nNeither the XSync (libXext) nor XScreensaver (libXss) development package was found.\nPlease install one of them (XSync is recommended)")
0075     endif()
0076 else()
0077     set(HAVE_X11 FALSE)
0078 endif()
0079 
0080 if(Qt5WaylandClient_FOUND)
0081     find_package(QtWaylandScanner REQUIRED)
0082     find_package(Wayland 1.9 REQUIRED Client)
0083     find_package(PlasmaWaylandProtocols 1.6.0 CONFIG REQUIRED)
0084     find_package(WaylandProtocols 1.27)
0085     set_package_properties(WaylandProtocols PROPERTIES
0086         TYPE REQUIRED
0087         PURPOSE "Collection of Wayland protocols that add functionality not available in the Wayland core protocol"
0088         URL "https://gitlab.freedesktop.org/wayland/wayland-protocols/"
0089     )
0090 endif()
0091 
0092 set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].")
0093 
0094 option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF)
0095 add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)")
0096 
0097 ecm_set_disabled_deprecation_versions(
0098     QT 5.15.2
0099     KF 5.97
0100 )
0101 
0102 # Subdirectories
0103 add_subdirectory(src)
0104 add_subdirectory(examples)
0105 
0106 # create a Config.cmake and a ConfigVersion.cmake file and install them
0107 set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5IdleTime")
0108 
0109 if (BUILD_QCH)
0110     ecm_install_qch_export(
0111         TARGETS KF5IdleTime_QCH
0112         FILE KF5IdleTimeQchTargets.cmake
0113         DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0114         COMPONENT Devel
0115     )
0116     set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF5IdleTimeQchTargets.cmake\")")
0117 endif()
0118 
0119 configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KF5IdleTimeConfig.cmake.in"
0120                               "${CMAKE_CURRENT_BINARY_DIR}/KF5IdleTimeConfig.cmake"
0121                               INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
0122                               )
0123 
0124 install(FILES  "${CMAKE_CURRENT_BINARY_DIR}/KF5IdleTimeConfig.cmake"
0125                "${CMAKE_CURRENT_BINARY_DIR}/KF5IdleTimeConfigVersion.cmake"
0126         DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0127         COMPONENT Devel )
0128 
0129 install(EXPORT KF5IdleTimeTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5IdleTimeTargets.cmake NAMESPACE KF5:: )
0130 
0131 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kidletime_version.h
0132         DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/KIdleTime COMPONENT Devel)
0133 
0134 feature_summary(WHAT ALL   FATAL_ON_MISSING_REQUIRED_PACKAGES)
0135 
0136 kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)