2
0

CMakeLists.txt 2.9 KB

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