CMakeLists.txt 2.2 KB

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