2
0

CMakeLists.txt 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. cmake_minimum_required(VERSION 3.0.2)
  2. project(fancontroller)
  3. #options
  4. option(NO_SYSTEMD "Compile without Systemd support. Reduces functionality significantly!" OFF)
  5. option(BUILD_GUI "Build the standalone application" ON)
  6. option(BUILD_KCM "Build the KCM" OFF)
  7. option(BUILD_HELPER "Build the KHelper" ON)
  8. option(INSTALL_SHARED "Install the shared parts" ON)
  9. #variables
  10. set(STANDARD_SERVICE_NAME "fancontrol" CACHE STRING "The name of the systemd service for the fancontrol script")
  11. set(STANDARD_CONFIG_FILE "/etc/fancontrol" CACHE STRING "The location of the standard config file for the fancontrol script")
  12. add_definitions(-DSTANDARD_SERVICE_NAME="${STANDARD_SERVICE_NAME}")
  13. add_definitions(-DSTANDARD_CONFIG_FILE="${STANDARD_CONFIG_FILE}")
  14. #KCM can't be build without systemd support
  15. if(BUILD_KCM AND NO_SYSTEMD)
  16. message(WARNING "KCM can't be build without systemd support")
  17. set(BUILD_KCM FALSE)
  18. endif(BUILD_KCM AND NO_SYSTEMD)
  19. #Silence warnings
  20. cmake_policy(SET CMP0037 OLD)
  21. cmake_policy(SET CMP0063 NEW)
  22. #Find ECM
  23. find_package(ECM REQUIRED)
  24. set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
  25. #includes
  26. include(KDEInstallDirs)
  27. include(KDECMakeSettings)
  28. include(KDECompilerSettings)
  29. include(FeatureSummary)
  30. include(FindPkgConfig)
  31. #Find Qt5
  32. find_package(Qt5Core REQUIRED)
  33. find_package(Qt5 COMPONENTS Quick)
  34. set_package_properties(Qt5Quick PROPERTIES TYPE RUNTIME PURPOSE "Needed by the QML parts")
  35. #Find KF5
  36. find_package(KF5 COMPONENTS I18n REQUIRED)
  37. find_package(KF5 COMPONENTS Kirigami2)
  38. set_package_properties(KF5Kirigami2 PROPERTIES TYPE RUNTIME PURPOSE "Needed by the QML parts")
  39. if(${KF5_VERSION} VERSION_GREATER_EQUAL 5.33.0)
  40. include(ECMGenerateQmlTypes)
  41. endif(${KF5_VERSION} VERSION_GREATER_EQUAL 5.33.0)
  42. include_directories (${CMAKE_SOURCE_DIR})
  43. #Systemd
  44. if(NOT NO_SYSTEMD)
  45. message(STATUS "Compiling for Systemd")
  46. else(NOT NO_SYSTEMD)
  47. message(STATUS "Compiling without Systemd")
  48. set(NO_SYSTEMD true)
  49. add_definitions(-DNO_SYSTEMD)
  50. endif(NOT NO_SYSTEMD)
  51. #KHelper for actions that require superuser rights
  52. if(BUILD_HELPER)
  53. add_subdirectory(helper)
  54. endif(BUILD_HELPER)
  55. #Build the standalone application
  56. if(BUILD_GUI)
  57. message(STATUS "Build the standalone application")
  58. add_subdirectory(fancontrol-gui)
  59. endif(BUILD_GUI)
  60. #Build the KCM
  61. if(BUILD_KCM)
  62. message(STATUS "Build the KCM")
  63. add_subdirectory(kcm)
  64. endif(BUILD_KCM)
  65. #build and install the shared parts
  66. if(INSTALL_SHARED)
  67. #qml plugin
  68. add_subdirectory(import)
  69. #icon
  70. include(ECMInstallIcons)
  71. ecm_install_icons(ICONS sc-apps-org.kde.fancontrol.gui.svg DESTINATION "${KDE_INSTALL_ICONDIR}")
  72. #translations
  73. ki18n_install(po)
  74. endif(INSTALL_SHARED)
  75. #summary
  76. feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)