CMakeLists.txt 3.08 KB
Newer Older
1
cmake_minimum_required(VERSION 3.16)
2

3
project(KDE-CLI-Tools)
4
set(PROJECT_VERSION "5.23.0")
5

6
set(QT_MIN_VERSION "5.15.0")
7
set(KF5_MIN_VERSION "5.86")
8
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
9

Nicolas Fella's avatar
Nicolas Fella committed
10
11
12
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

13
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
14
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
15

16
17
include(KDEInstallDirs)
include(KDECMakeSettings)
18
include(KDECompilerSettings NO_POLICY_SCOPE)
19
20
21
include(ECMMarkAsTest)
include(ECMMarkNonGuiExecutable)
include(FeatureSummary)
Martin Flöser's avatar
Martin Flöser committed
22
include(CheckIncludeFile)
23
include(CheckIncludeFiles)
Martin Flöser's avatar
Martin Flöser committed
24
include(CheckSymbolExists)
25
include(ECMOptionalAddSubdirectory)
26
include(KDEClangFormat)
27

28
include(KDEGitCommitHooks)
29

30
31
32
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
    Widgets
    Svg
33
    DBus
34
35
)

36
37
38
39
40
41
42
43
44
find_package(Qt5Test ${QT_MIN_VERSION} CONFIG QUIET)
set_package_properties(Qt5Test PROPERTIES
         PURPOSE "Required for tests"
         TYPE OPTIONAL
         )
add_feature_info("Qt5Test" Qt5Test_FOUND "Required for building tests")
if (NOT Qt5Test_FOUND)
    set(BUILD_TESTING OFF CACHE BOOL "Build the testing tree.")
endif()
45

Martin Flöser's avatar
Martin Flöser committed
46
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
47
    Config
Christoph Feck's avatar
Christoph Feck committed
48
    DocTools
49
50
    IconThemes
    I18n
51
    KCMUtils
Christoph Feck's avatar
Christoph Feck committed
52
    KIO
53
    Service
54
    WindowSystem
55
    Activities
56
    Declarative
Hannah von Reth's avatar
Hannah von Reth committed
57
58
59
    OPTIONAL_COMPONENTS
    Su
    QUIET
60
)
61
62
find_package(LibKWorkspace ${PROJECT_VERSION} REQUIRED)

63
64
65
# Disables automatic conversions from QString (or char *) to QUrl.
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)

Lukáš Tinkl's avatar
Lukáš Tinkl committed
66
find_package(X11)
Hrvoje Senjan's avatar
Hrvoje Senjan committed
67
find_package(XCB COMPONENTS XCB)
Lukáš Tinkl's avatar
Lukáš Tinkl committed
68
69
if(X11_FOUND AND XCB_XCB_FOUND)
  set(HAVE_X11 1)
Hannah von Reth's avatar
Hannah von Reth committed
70
  find_package(Qt5X11Extras ${QT_MIN_VERSION} CONFIG)
Lukáš Tinkl's avatar
Lukáš Tinkl committed
71
72
endif()

73
74
include_directories(${CMAKE_CURRENT_BINARY_DIR})

75
76
add_subdirectory(doc)

77
78
79
80
add_subdirectory(kcmshell)
add_subdirectory(keditfiletype)
add_subdirectory(kmimetypefinder)
add_subdirectory(ktraderclient)
81
add_subdirectory(kioclient)
82
add_subdirectory(ksvgtopng)
83
add_subdirectory(kdeinhibit)
84
add_subdirectory(plasma-open-settings)
85

86
if(Qt5X11Extras_FOUND)
87
88
89
    add_subdirectory(kstart)
endif()

Hannah von Reth's avatar
Hannah von Reth committed
90
91

if(KF5Su_FOUND)
92
    add_subdirectory(kdesu)
Hannah von Reth's avatar
Hannah von Reth committed
93
endif()
Hannah von Reth's avatar
Hannah von Reth committed
94

Hannah von Reth's avatar
Hannah von Reth committed
95
if(UNIX)
96
    add_subdirectory(kdeeject)
97
    add_subdirectory(kbroadcastnotification)
98
endif()
99
100

check_include_files(sys/wait.h HAVE_SYS_WAIT_H)
Martin Flöser's avatar
Martin Flöser committed
101
102
103

check_include_file("sys/prctl.h" HAVE_SYS_PRCTL_H)
check_symbol_exists(PR_SET_DUMPABLE "sys/prctl.h" HAVE_PR_SET_DUMPABLE)
104
105
106
107
108
109
110
111
check_include_file("sys/procctl.h" HAVE_SYS_PROCCTL_H)
check_symbol_exists(PROC_TRACE_CTL "sys/procctl.h" HAVE_PROC_TRACE_CTL)
if (HAVE_PR_SET_DUMPABLE OR HAVE_PROC_TRACE_CTL)
  set(CAN_DISABLE_PTRACE TRUE)
endif()
add_feature_info("prctl-dumpable"
                 CAN_DISABLE_PTRACE
                "Required for disallowing ptrace on kdesu process")
Martin Flöser's avatar
Martin Flöser committed
112

113
configure_file (config-kde-cli-tools.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kde-cli-tools.h )
114

115
116
117
118
# add clang-format target for all our real source files
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})

119
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
120

121
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)