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.99.0") # handled by release scripts
0004 project(KIdleTime VERSION ${KF_VERSION})
0005 
0006 # ECM setup
0007 include(FeatureSummary)
0008 find_package(ECM 5.99.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 endif()
0085 
0086 set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].")
0087 
0088 option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF)
0089 add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)")
0090 
0091 ecm_set_disabled_deprecation_versions(
0092     QT 5.15.2
0093     KF 5.97
0094 )
0095 
0096 # Subdirectories
0097 add_subdirectory(src)
0098 add_subdirectory(examples)
0099 
0100 # create a Config.cmake and a ConfigVersion.cmake file and install them
0101 set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5IdleTime")
0102 
0103 if (BUILD_QCH)
0104     ecm_install_qch_export(
0105         TARGETS KF5IdleTime_QCH
0106         FILE KF5IdleTimeQchTargets.cmake
0107         DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0108         COMPONENT Devel
0109     )
0110     set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF5IdleTimeQchTargets.cmake\")")
0111 endif()
0112 
0113 configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KF5IdleTimeConfig.cmake.in"
0114                               "${CMAKE_CURRENT_BINARY_DIR}/KF5IdleTimeConfig.cmake"
0115                               INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
0116                               )
0117 
0118 install(FILES  "${CMAKE_CURRENT_BINARY_DIR}/KF5IdleTimeConfig.cmake"
0119                "${CMAKE_CURRENT_BINARY_DIR}/KF5IdleTimeConfigVersion.cmake"
0120         DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
0121         COMPONENT Devel )
0122 
0123 install(EXPORT KF5IdleTimeTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5IdleTimeTargets.cmake NAMESPACE KF5:: )
0124 
0125 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kidletime_version.h
0126         DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/KIdleTime COMPONENT Devel)
0127 
0128 feature_summary(WHAT ALL   FATAL_ON_MISSING_REQUIRED_PACKAGES)
0129 
0130 kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)