CMakeLists.txt 2.5 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(BUILD_HELPER "Build the KHelper" ON)
  8. option(INSTALL_SHARED "Install the shared parts" 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. set(KDE_INSTALL_USE_QT_SYS_PATHS ON CACHE BOOL "Use Qt install paths so the qml plugin is always found" FORCE)
  15. #KCM can't be build without systemd support
  16. if(BUILD_KCM AND NO_SYSTEMD)
  17. message(WARNING "KCM can't be build without systemd support")
  18. set(BUILD_KCM FALSE)
  19. endif(BUILD_KCM AND NO_SYSTEMD)
  20. #Silence warnings
  21. cmake_policy(SET CMP0037 OLD)
  22. cmake_policy(SET CMP0063 NEW)
  23. #Find ECM
  24. find_package(ECM REQUIRED)
  25. set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
  26. #Find Qt5
  27. find_package(Qt5Core REQUIRED)
  28. #Find KF5
  29. find_package(KF5 COMPONENTS I18n REQUIRED)
  30. #includes
  31. include(KDEInstallDirs)
  32. include(KDECMakeSettings)
  33. include(KDECompilerSettings)
  34. include(FeatureSummary)
  35. include(ECMGenerateQmlTypes)
  36. include_directories (${CMAKE_SOURCE_DIR})
  37. #Systemd
  38. if(NOT NO_SYSTEMD)
  39. message(STATUS "Compiling for Systemd")
  40. else(NOT NO_SYSTEMD)
  41. message(STATUS "Compiling without Systemd")
  42. set(NO_SYSTEMD true)
  43. add_definitions(-DNO_SYSTEMD)
  44. endif(NOT NO_SYSTEMD)
  45. #KHelper for actions that require superuser rights
  46. if(BUILD_HELPER)
  47. add_subdirectory(helper)
  48. endif(BUILD_HELPER)
  49. #Build the standalone application
  50. if(BUILD_GUI)
  51. message(STATUS "Build the standalone application")
  52. add_subdirectory(fancontrol-gui)
  53. endif(BUILD_GUI)
  54. #Build the KCM
  55. if(BUILD_KCM)
  56. message(STATUS "Build the KCM")
  57. add_subdirectory(kcm)
  58. endif(BUILD_KCM)
  59. #build and install the shared parts
  60. if(INSTALL_SHARED)
  61. #qml plugin
  62. add_subdirectory(import)
  63. #icon
  64. install(FILES icon.svg RENAME "fancontrol_gui.svg" DESTINATION "${KDE_INSTALL_ICONDIR}/hicolor/scalable/apps")
  65. #translations
  66. ki18n_install(po)
  67. endif(INSTALL_SHARED)
  68. #summary
  69. feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)