CMakeLists.txt 2.0 KB

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