CMakeLists.txt 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. add_definitions(-DSTANDARD_SERVICE_NAME="${STANDARD_SERVICE_NAME}")
  12. #KCM can't be build without systemd support
  13. if(BUILD_KCM AND NO_SYSTEMD)
  14. message(WARNING "KCM can't be build without systemd support")
  15. set(BUILD_KCM FALSE)
  16. endif(BUILD_KCM AND NO_SYSTEMD)
  17. #Silence warnings
  18. cmake_policy(SET CMP0037 OLD)
  19. cmake_policy(SET CMP0063 NEW)
  20. #Find ECM
  21. find_package(ECM REQUIRED)
  22. set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
  23. #Find Qt5
  24. find_package(Qt5Core REQUIRED)
  25. #Find KF5
  26. find_package(KF5 COMPONENTS I18n Package REQUIRED)
  27. #includes
  28. include(GenerateExportHeader)
  29. include(KDEInstallDirs)
  30. include(KDECMakeSettings)
  31. include(KDECompilerSettings)
  32. include(FeatureSummary)
  33. include_directories (${CMAKE_SOURCE_DIR})
  34. #Systemd
  35. if(NOT NO_SYSTEMD)
  36. message(STATUS "Compiling for Systemd")
  37. find_package(Qt5DBus REQUIRED)
  38. include_directories(${Qt5DBus_INCLUDE_DIRS})
  39. else(NOT NO_SYSTEMD)
  40. message(STATUS "Compiling without Systemd")
  41. set(NO_SYSTEMD true)
  42. add_definitions(-DNO_SYSTEMD)
  43. endif(NOT NO_SYSTEMD)
  44. #Shared library
  45. add_subdirectory(lib)
  46. #KHelper for actions that require superuser rights
  47. if(INSTALL_HELPER)
  48. add_subdirectory(helper)
  49. endif(INSTALL_HELPER)
  50. #Build the standalone application
  51. if(BUILD_GUI)
  52. message(STATUS "Build the standalone application")
  53. add_subdirectory(fancontrol-gui)
  54. endif(BUILD_GUI)
  55. #Build the KCM
  56. if(BUILD_KCM)
  57. message(STATUS "Build the KCM")
  58. add_subdirectory(kcm)
  59. endif(BUILD_KCM)
  60. #install the shared parts
  61. if(INSTALL_SHARED)
  62. #KPackage containing the QML and javascript files
  63. kpackage_install_package(package kcm_fancontrol kcms)
  64. #icon
  65. install(FILES icon.svg RENAME "fancontrol_gui.svg" DESTINATION "${ICON_INSTALL_DIR}/hicolor/scalable/apps")
  66. #translations
  67. ki18n_install(po)
  68. endif(INSTALL_SHARED)
  69. #add tests
  70. add_subdirectory(tests)
  71. #summary
  72. feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)