2
0

CMakeLists.txt 3.2 KB

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