CMakeLists.txt 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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_directories (${CMAKE_SOURCE_DIR})
  36. #Systemd
  37. if(NOT NO_SYSTEMD)
  38. message(STATUS "Compiling for Systemd")
  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. #KHelper for actions that require superuser rights
  45. if(BUILD_HELPER)
  46. add_subdirectory(helper)
  47. endif(BUILD_HELPER)
  48. #Build the standalone application
  49. if(BUILD_GUI)
  50. message(STATUS "Build the standalone application")
  51. add_subdirectory(fancontrol-gui)
  52. endif(BUILD_GUI)
  53. #Build the KCM
  54. if(BUILD_KCM)
  55. message(STATUS "Build the KCM")
  56. add_subdirectory(kcm)
  57. endif(BUILD_KCM)
  58. #build and install the shared parts
  59. if(INSTALL_SHARED)
  60. #qml plugin
  61. add_subdirectory(import)
  62. #icon
  63. install(FILES icon.svg RENAME "fancontrol_gui.svg" DESTINATION "${KDE_INSTALL_ICONDIR}/hicolor/scalable/apps")
  64. #translations
  65. ki18n_install(po)
  66. endif(INSTALL_SHARED)
  67. #add tests
  68. #add_subdirectory(tests)
  69. #summary
  70. feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)