2
0

CMakeLists.txt 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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(INSTALL_SHARED "Install the shared parts" ON)
  8. option(INSTALL_HELPER "Install the KHelper" 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. #Find Qt5
  26. find_package(Qt5Core REQUIRED)
  27. #Find KF5
  28. find_package(KF5 COMPONENTS I18n Package REQUIRED)
  29. #includes
  30. include(GenerateExportHeader)
  31. include(KDEInstallDirs)
  32. include(KDECMakeSettings)
  33. include(KDECompilerSettings)
  34. include(FeatureSummary)
  35. include_directories (${CMAKE_SOURCE_DIR})
  36. #Systemd
  37. if(NOT NO_SYSTEMD)
  38. message(STATUS "Compiling for Systemd")
  39. find_package(Qt5DBus REQUIRED)
  40. include_directories(${Qt5DBus_INCLUDE_DIRS})
  41. else(NOT NO_SYSTEMD)
  42. message(STATUS "Compiling without Systemd")
  43. set(NO_SYSTEMD true)
  44. add_definitions(-DNO_SYSTEMD)
  45. endif(NOT NO_SYSTEMD)
  46. #Shared library
  47. add_subdirectory(lib)
  48. #KHelper for actions that require superuser rights
  49. if(INSTALL_HELPER)
  50. add_subdirectory(helper)
  51. endif(INSTALL_HELPER)
  52. #Build the standalone application
  53. if(BUILD_GUI)
  54. message(STATUS "Build the standalone application")
  55. add_subdirectory(fancontrol-gui)
  56. endif(BUILD_GUI)
  57. #Build the KCM
  58. if(BUILD_KCM)
  59. message(STATUS "Build the KCM")
  60. add_subdirectory(kcm)
  61. endif(BUILD_KCM)
  62. #install the shared parts
  63. if(INSTALL_SHARED)
  64. #KPackage containing the QML and javascript files
  65. kpackage_install_package(package kcm_fancontrol kcms)
  66. #icon
  67. install(FILES icon.svg RENAME "fancontrol_gui.svg" DESTINATION "${ICON_INSTALL_DIR}/hicolor/scalable/apps")
  68. #translations
  69. ki18n_install(po)
  70. endif(INSTALL_SHARED)
  71. #add tests
  72. add_subdirectory(tests)
  73. #summary
  74. feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)