|
| 1 | +project(Hawaii) |
| 2 | + |
| 3 | +cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) |
| 4 | + |
| 5 | +# Find includes in corresponding build directories |
| 6 | +set(CMAKE_INCLUDE_CURRENT_DIR ON) |
| 7 | + |
| 8 | +# Instruct CMake to run moc automatically when needed |
| 9 | +set(CMAKE_AUTOMOC ON) |
| 10 | + |
| 11 | +# Options |
| 12 | +option(ENABLE_SYSTEMD "Enables systemd support" ON) |
| 13 | + |
| 14 | +# Set version |
| 15 | +set(PROJECT_VERSION "0.0.0") |
| 16 | + |
| 17 | +# ECM |
| 18 | +find_package(ECM 0.0.11 REQUIRED NO_MODULE) |
| 19 | +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) |
| 20 | + |
| 21 | +# Installation directories |
| 22 | +include(KDEInstallDirs) |
| 23 | + |
| 24 | +# Other macros |
| 25 | +include(KDECMakeSettings) |
| 26 | +include(KDECompilerSettings) |
| 27 | + |
| 28 | +# Macro to print feature summary |
| 29 | +include(FeatureSummary) |
| 30 | + |
| 31 | +# Find pkg-config here so that it can be referenced soon |
| 32 | +find_package(PkgConfig) |
| 33 | + |
| 34 | +# systemd user unit directory |
| 35 | +if (NOT DEFINED SYSTEMD_USER_UNIT_DIR) |
| 36 | + execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=systemduserunitdir systemd OUTPUT_VARIABLE SYSTEMD_USER_UNIT_DIR) |
| 37 | + string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_USER_UNIT_DIR ${SYSTEMD_USER_UNIT_DIR}) |
| 38 | +endif() |
| 39 | +message(STATUS "systemd user unit directory: ${SYSTEMD_USER_UNIT_DIR}") |
| 40 | + |
| 41 | +# Add custom uninstall target |
| 42 | +if ("${ECM_VERSION}" VERSION_LESS "1.7.0") |
| 43 | + # ECM 1.7.0 provides this target, so we can't roll our own (see issue #172) |
| 44 | + configure_file( |
| 45 | + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" |
| 46 | + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" |
| 47 | + IMMEDIATE @ONLY) |
| 48 | + add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") |
| 49 | +endif() |
| 50 | + |
| 51 | +# Set up packaging |
| 52 | +set(CPACK_PACKAGE_NAME "hawaii-baseapps") |
| 53 | +set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") |
| 54 | +set(CPACK_GENERATOR "TGZ") |
| 55 | +set(CPACK_SET_DESTDIR FALSE) |
| 56 | +set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") |
| 57 | +set(CPACK_SOURCE_IGNORE_FILES "/build/;/.git;/*.user;/.tx/;~$;${CPACK_SOURCE_IGNORE_FILES}") |
| 58 | +include(CPack) |
| 59 | +add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source) |
| 60 | + |
| 61 | +# Assume release build by default |
| 62 | +if(NOT CMAKE_BUILD_TYPE) |
| 63 | + set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "" FORCE) |
| 64 | +endif() |
| 65 | + |
| 66 | +# Minimum version requirements |
| 67 | +set(QT_MIN_VERSION "5.4.0") |
| 68 | + |
| 69 | +# Find Qt5 |
| 70 | +find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS |
| 71 | + Core |
| 72 | + DBus |
| 73 | + Gui |
| 74 | + Qml |
| 75 | + Quick) |
| 76 | + |
| 77 | +# FInd PolicyKit Qt5 |
| 78 | +find_package(PolkitQt5-1 REQUIRED 0.103.0) |
| 79 | + |
| 80 | +# Find systemd |
| 81 | +if(ENABLE_SYSTEMD) |
| 82 | + pkg_check_modules(systemd libsystemd-daemon) |
| 83 | + if(systemd_FOUND) |
| 84 | + set(HAVE_SYSTEMD 1) |
| 85 | + else() |
| 86 | + # libsystem-daemon was merged to libsystem on systemd 208->209 |
| 87 | + pkg_check_modules(systemd libsystemd) |
| 88 | + if(systemd_FOUND) |
| 89 | + set(HAVE_SYSTEMD 1) |
| 90 | + endif() |
| 91 | + endif() |
| 92 | + add_feature_info("systemd" systemd_FOUND "Required for systemd integration") |
| 93 | +else() |
| 94 | + set(HAVE_SYSTEMD 0) |
| 95 | +endif() |
| 96 | + |
| 97 | +# Subdirectories |
| 98 | +add_subdirectory(headers) |
| 99 | +add_subdirectory(polkitagent) |
| 100 | + |
| 101 | +# Display featute summary |
| 102 | +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) |
0 commit comments