2
0

CMakeLists.txt 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. cmake_minimum_required(VERSION 3.0.2)
  2. project(fancontroller)
  3. set(QT_MIN_VERSION "5.8.0")
  4. #options
  5. option(NO_SYSTEMD "Compile without Systemd support. Reduces functionality significantly!" OFF)
  6. option(BUILD_GUI "Build the standalone application" ON)
  7. option(BUILD_KCM "Build the KCM" OFF)
  8. option(BUILD_PLASMOID "Build the plasmoid" OFF)
  9. option(BUILD_HELPER "Build the KHelper" ON)
  10. option(INSTALL_SHARED "Install the shared parts" ON)
  11. option(INSTALL_POLKIT "Install polkit files and rules" OFF)
  12. #variables
  13. set(STANDARD_SERVICE_NAME "fancontrol" CACHE STRING "The name of the systemd service for the fancontrol script")
  14. set(STANDARD_CONFIG_FILE "/etc/fancontrol" CACHE STRING "The location of the standard config file for the fancontrol script")
  15. set(STANDARD_HELPER_ID "org.kde.fancontrol.gui.helper" CACHE STRING "The standard id for the KAuth helper")
  16. set(POLKIT_GROUP_NAME "fancontrol" CACHE STRING "The group which is granted elevated permissions by polkit to manipulate fancontrol")
  17. add_definitions(-DSTANDARD_SERVICE_NAME="${STANDARD_SERVICE_NAME}")
  18. add_definitions(-DSTANDARD_CONFIG_FILE="${STANDARD_CONFIG_FILE}")
  19. add_definitions(-DSTANDARD_HELPER_ID="${STANDARD_HELPER_ID}")
  20. #KCM can't be build without systemd support
  21. if(BUILD_KCM AND NO_SYSTEMD)
  22. message(WARNING "KCM can't be build without systemd support")
  23. set(BUILD_KCM FALSE)
  24. endif(BUILD_KCM AND NO_SYSTEMD)
  25. #Silence warnings
  26. cmake_policy(SET CMP0063 NEW)
  27. #Find ECM
  28. find_package(ECM 5.38 REQUIRED)
  29. set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
  30. #includes
  31. include(KDEInstallDirs)
  32. include(KDECMakeSettings)
  33. include(KDECompilerSettings)
  34. include(FeatureSummary)
  35. include(FindPkgConfig)
  36. include(ECMQMLModules)
  37. #Find Qt5
  38. find_package(Qt5Core ${QT_MIN_VERSION} REQUIRED)
  39. #Find KF5
  40. find_package(KF5 COMPONENTS I18n REQUIRED)
  41. #Find QML modules
  42. ecm_find_qmlmodule(QtQuick 2.6)
  43. ecm_find_qmlmodule(QtQuick.Controls 2.1)
  44. ecm_find_qmlmodule(QtQuick.Layouts 1.2)
  45. ecm_find_qmlmodule(QtQuick.Dialogs 1.2)
  46. ecm_find_qmlmodule(org.kde.kirigami 2.3)
  47. include_directories (${CMAKE_SOURCE_DIR})
  48. #Systemd
  49. if(NOT NO_SYSTEMD)
  50. message(STATUS "Compiling for Systemd")
  51. else(NOT NO_SYSTEMD)
  52. message(STATUS "Compiling without Systemd")
  53. set(NO_SYSTEMD true)
  54. add_definitions(-DNO_SYSTEMD)
  55. endif(NOT NO_SYSTEMD)
  56. #KHelper for actions that require superuser rights
  57. if(BUILD_HELPER)
  58. add_subdirectory(helper)
  59. endif(BUILD_HELPER)
  60. #Build the standalone application
  61. if(BUILD_GUI)
  62. message(STATUS "Build the standalone application")
  63. add_subdirectory(fancontrol-gui)
  64. endif(BUILD_GUI)
  65. #Build the KCM
  66. if(BUILD_KCM)
  67. message(STATUS "Build the KCM")
  68. add_subdirectory(kcm)
  69. endif(BUILD_KCM)
  70. #Build the plasmoid
  71. if(BUILD_PLASMOID)
  72. message(STATUS "Build the plasmoid")
  73. add_subdirectory(plasmoid)
  74. endif(BUILD_PLASMOID)
  75. #build and install the shared parts
  76. if(INSTALL_SHARED)
  77. #qml plugin
  78. add_subdirectory(import)
  79. #icon
  80. include(ECMInstallIcons)
  81. ecm_install_icons(ICONS sc-apps-org.kde.fancontrol.gui.svg DESTINATION "${KDE_INSTALL_ICONDIR}")
  82. #translations
  83. ki18n_install(po)
  84. endif(INSTALL_SHARED)
  85. #install polkit files
  86. if(INSTALL_POLKIT)
  87. add_subdirectory(polkit)
  88. endif(INSTALL_POLKIT)
  89. #summary
  90. feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)