CMakeLists.txt 5.56 KB
Newer Older
1
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
2
3

# KDE Application Version, managed by release script
4
set (RELEASE_SERVICE_VERSION_MAJOR "21")
5
set (RELEASE_SERVICE_VERSION_MINOR "11")
6
7
8
9
10
11
12
13
set (RELEASE_SERVICE_VERSION_MICRO "70")
set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
project(KTorrent VERSION ${RELEASE_SERVICE_VERSION})

add_definitions(-D'VERSION="${RELEASE_SERVICE_VERSION}"'
                -D'VERSION_MAJOR=${RELEASE_SERVICE_VERSION_MAJOR}'
                -D'VERSION_MINOR=${RELEASE_SERVICE_VERSION_MINOR}'
                -D'VERSION_MICRO=${RELEASE_SERVICE_VERSION_MICRO}')
14

15
16
set (QT_MIN_VERSION "5.15.0")
set (KF5_MIN_VERSION "5.82")
17
set (LIBKTORRENT_MIN_VERSION "20.11.70")
18
set (Boost_MIN_VERSION "1.71.0")
19

Nicolas Fella's avatar
Nicolas Fella committed
20
21
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
22
23
24

include(KDEInstallDirs)
include(KDECMakeSettings)
25
include(KDECompilerSettings NO_POLICY_SCOPE)
26
include(FeatureSummary)
Nick Shaforostoff's avatar
Nick Shaforostoff committed
27
include(GenerateExportHeader)
28
include(ECMInstallIcons)
Andrius Štikonas's avatar
Andrius Štikonas committed
29
include(ECMAddAppIcon)
Andrius Štikonas's avatar
Andrius Štikonas committed
30
include(ECMMarkAsTest)
31
include(ECMMarkNonGuiExecutable)
Alexander Lohnau's avatar
Alexander Lohnau committed
32
include(KDEClangFormat)
33
include(KDEGitCommitHooks)
34

35
set(CMAKE_CXX_STANDARD 17)
36
37
set(CMAKE_CXX_STANDARD_REQUIRED ON)

38
39
40
41
42
43
44
45
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED
    Core
    DBus
    Network
    Widgets
)

find_package(KF5 ${KF5_MIN_VERSION} REQUIRED
46
  COMPONENTS
47
    Config
Andrius Štikonas's avatar
Andrius Štikonas committed
48
    ConfigWidgets
49
50
    CoreAddons
    Crash
Andrius Štikonas's avatar
Andrius Štikonas committed
51
    DBusAddons
52
    I18n
53
    IconThemes
54
55
56
57
58
59
60
61
62
    KIO
    Notifications
    NotifyConfig
    KCMUtils
    Parts
    Solid
    WidgetsAddons
    WindowSystem
    XmlGui
63
64
  OPTIONAL_COMPONENTS
    DocTools
65
)
66

67
find_package(KF5Torrent ${LIBKTORRENT_MIN_VERSION} CONFIG REQUIRED)
68
find_package(Boost ${Boost_MIN_VERSION} REQUIRED)
69

70
find_package(KF5TextWidgets ${KF5_MIN_VERSION})
71
72
73
74
75
set_package_properties(KF5TextWidgets
  PROPERTIES
  TYPE OPTIONAL
  PURPOSE "Required for KTorrent's IP Filter plugin"
)
76
77
78
if(KF5TextWidgets_FOUND)
  set(HAVE_KF5TextWidgets 1)
endif()
79

80
find_package(KF5Archive ${KF5_MIN_VERSION})
81
82
83
84
85
set_package_properties(KF5Archive
  PROPERTIES
  TYPE OPTIONAL
  PURPOSE "Required for KTorrent's scripting plugin"
)
86
87
88
if(KF5Archive_FOUND)
  set(HAVE_KF5Archive 1)
endif()
89

90
find_package(KF5ItemViews ${KF5_MIN_VERSION})
91
92
93
94
95
set_package_properties(KF5ItemViews
  PROPERTIES
  TYPE OPTIONAL
  PURPOSE "Required for KTorrent's scripting plugin"
)
96
97
98
if(KF5ItemViews_FOUND)
  set(HAVE_KF5ItemViews 1)
endif()
99

100
find_package(KF5Kross ${KF5_MIN_VERSION})
101
102
103
104
105
set_package_properties(KF5Kross
  PROPERTIES
  TYPE OPTIONAL
  PURPOSE "Required for KTorrent's scripting plugin"
)
106
107
108
if(KF5Kross_FOUND)
  set(HAVE_KF5Kross 1)
endif()
109

110
find_package(KF5Plotting ${KF5_MIN_VERSION})
111
112
113
114
115
set_package_properties(KF5Plotting
  PROPERTIES
  TYPE OPTIONAL
  PURPOSE "Required for KTorrent's statistics plugin"
)
116
117
118
if(KF5Plotting_FOUND)
  set(HAVE_KF5Plotting 1)
endif()
119

120
find_package(KF5Syndication ${KF5_MIN_VERSION})
121
122
123
124
125
set_package_properties(KF5Syndication
  PROPERTIES
  TYPE OPTIONAL
  PURPOSE "Required for KTorrent's syndication plugin"
)
126
127
128
129
if(KF5Syndication_FOUND)
  set(HAVE_KF5Syndication 1)
endif()

Gilbert Assaf's avatar
Gilbert Assaf committed
130
131
find_package(Qt5WebEngineWidgets ${QT_MIN_VERSION})
set_package_properties(Qt5WebEngineWidgets
132
133
  PROPERTIES
  TYPE OPTIONAL
134
  PURPOSE "Required for KTorrent's search and syndication plugins"
135
)
Gilbert Assaf's avatar
Gilbert Assaf committed
136
137
if(Qt5WebEngineWidgets_FOUND)
  set(HAVE_Qt5WebEngineWidgets 1)
138
endif()
139

140
find_package(KF5DNSSD ${KF5_MIN_VERSION})
141
142
143
144
145
set_package_properties(KF5DNSSD
  PROPERTIES
  TYPE OPTIONAL
  PURPOSE "Required for KTorrent's Zeroconf plugin"
)
146
147
148
if(KF5DNSSD_FOUND)
  set(HAVE_KF5DNSSD 1)
endif()
149

150
find_package(KF5Completion ${KF5_MIN_VERSION})
151
152
153
154
155
set_package_properties(KF5Completion
  PROPERTIES
  TYPE OPTIONAL
  PURPOSE "Required for KTorrent's UPnP plugin"
)
156
157
158
if(KF5Completion_FOUND)
  set(HAVE_KF5Completion 1)
endif()
159
160
161
162
163
164
165

find_package(LibKWorkspace CONFIG)
set_package_properties(LibKWorkspace
  PROPERTIES
  TYPE OPTIONAL
  PURPOSE "Required for KTorrent's shutdown plugin"
)
166
167
168
if(LibKWorkspace_FOUND)
  set(HAVE_LibKWorkspace 1)
endif()
169
170

#find_package(Qt5 ${QT_MIN_VERSION} OPTIONAL_COMPONENTS Multimedia MultimediaWidgets)
171
172

find_package(Taglib)
173
174
175
176
177
set_package_properties(Taglib
  PROPERTIES
  TYPE OPTIONAL
  PURPOSE "Required for KTorrent's multimedia plugin"
)
178
179
180
181
182
183

if(TAGLIB_FOUND)
  set(HAVE_Taglib 1)
endif()

find_package(Phonon4Qt5)
184
185
186
187
188
189
set_package_properties(Phonon4Qt5
  PROPERTIES
  TYPE OPTIONAL
  PURPOSE "Required for KTorrent's multimedia plugin"
)

190

191
192
193
194
195
#
# checks for functions and stuff
#
include(CheckIncludeFiles)
include(CheckFunctionExists)
196
197
include(CheckTypeSize) #XFS

198

Ralf Habacker's avatar
Ralf Habacker committed
199
# according to http://www.cmake.org/pipermail/cmake/2008-June/022381.html
200
201
kde_enable_exceptions()

202
203
204
205
206
207
208
209
add_definitions(
  -DQT_USE_QSTRINGBUILDER
  -DQT_NO_CAST_TO_ASCII
  -DQT_NO_CAST_FROM_ASCII
  -DQT_STRICT_ITERATORS
  -DQT_NO_URL_CAST_FROM_STRING
  -DQT_NO_CAST_FROM_BYTEARRAY
  -DQT_NO_CAST_TO_BYTEARRAY
Andrius Štikonas's avatar
Andrius Štikonas committed
210
  -DQT_NO_KEYWORDS
211
212
213
  -DQT_USE_FAST_OPERATOR_PLUS
)

214
set (KTORRENT_DBUS_XML_DIR ${CMAKE_SOURCE_DIR}/dbus_xml)
215
set (KTORRENT_PLUGIN_INSTALL_DIR ${PLUGIN_INSTALL_DIR}/ktorrent)
216

217
include_directories(Boost::boost)
218

219
add_subdirectory(libktcore)
Nick Shaforostoff's avatar
Nick Shaforostoff committed
220
add_subdirectory(plugins)
221
add_subdirectory(ktorrent)
Andrius Štikonas's avatar
Andrius Štikonas committed
222
add_subdirectory(ktupnptest)
223
add_subdirectory(ktmagnetdownloader)
224
225
226
if (KF5DocTools_FOUND)
    add_subdirectory(doc)
endif()
Alexander Lohnau's avatar
Alexander Lohnau committed
227
228
229
# 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})
230
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
231
232
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)

Laurent Montel's avatar
Laurent Montel committed
233

234
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)