3 cmake_minimum_required(VERSION 2.8.12)
5 if(${CMAKE_SOURCE_DIR} STREQUAL ${kleopatra_SOURCE_DIR})
6 # Standalone build. Find / include everything neccessary.
7 set(KF5_VERSION "5.17.0")
8 set(GPGMEPP_VERSION "5.1.40")
9 set(KMIME_VERSION "5.1.40")
10 set(LIBKLEO_VERSION "5.1.41")
11 set(QT_REQUIRED_VERSION "5.4.0")
13 find_package(ECM ${KF5_VERSION} REQUIRED NO_MODULE)
14 set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
16 include(ECMOptionalAddSubdirectory)
17 include(ECMInstallIcons)
18 include(ECMSetupVersion)
20 include(ECMMarkNonGuiExecutable)
21 include(GenerateExportHeader)
22 include(ECMGenerateHeaders)
23 include(CMakePackageConfigHelpers)
24 include(FeatureSummary)
25 include(CheckFunctionExists)
26 include(ECMGeneratePriFile)
28 include(KDEInstallDirs)
29 include(KDECMakeSettings)
30 include(KDECompilerSettings NO_POLICY_SCOPE)
31 include(ECMAddAppIcon)
32 include(ECMQtDeclareLoggingCategory)
35 find_package(KF5Codecs ${KF5_VERSION} CONFIG REQUIRED)
36 find_package(KF5DBusAddons ${KF5_VERSION} CONFIG REQUIRED)
37 find_package(KF5KCMUtils ${KF5_VERSION} CONFIG REQUIRED)
38 find_package(KF5Config ${KF5_VERSION} CONFIG REQUIRED)
39 find_package(KF5I18n ${KF5_VERSION} CONFIG REQUIRED)
40 find_package(KF5IconThemes ${KF5_VERSION} CONFIG REQUIRED)
41 find_package(KF5Notifications ${KF5_VERSION} CONFIG REQUIRED)
42 find_package(KF5XmlGui ${KF5_VERSION} CONFIG REQUIRED)
43 find_package(KF5WindowSystem ${KF5_VERSION} CONFIG REQUIRED)
44 find_package(KF5TextWidgets ${KF5_VERSION} CONFIG REQUIRED)
47 find_package(KF5Libkleo ${LIBKLEO_VERSION} CONFIG REQUIRED)
48 find_package(KF5Mime ${KMIME_VERSION} CONFIG REQUIRED)
49 find_package(KF5Gpgmepp ${GPGMEPP_VERSION} CONFIG REQUIRED)
51 find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Test Network)
52 endif() # Standalone build
54 find_package(Boost 1.34.0 REQUIRED)
56 find_path(Boost_TOPOLOGICAL_SORT_DIR NAMES boost/graph/topological_sort.hpp PATHS ${Boost_INCLUDE_DIRS})
57 if(NOT Boost_TOPOLOGICAL_SORT_DIR)
58 message(FATAL_ERROR "The Boost Topological_sort header was NOT found. Should be part of Boost graph module.")
61 set(kleopatra_version 2.2.0)
62 set(kleopatra_release FALSE)
64 if(NOT kleopatra_release)
66 execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --oneline --format=%h ${CMAKE_CURRENT_SOURCE_DIR}
67 WORKING_DIRECTORY ${kdepim_SOURCE_DIR}/kleopatra
68 OUTPUT_VARIABLE Kleopatra_WC_REVISION)
69 string(REGEX REPLACE "\n" "" Kleopatra_WC_REVISION "${Kleopatra_WC_REVISION}")
71 execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --oneline --format=%ci ${CMAKE_CURRENT_SOURCE_DIR}
72 WORKING_DIRECTORY ${kdepim_SOURCE_DIR}/kleopatra
73 OUTPUT_VARIABLE Kleopatra_WC_LAST_CHANGED_DATE)
74 string(REGEX REPLACE " [-0-9:+ ]*\n" "" Kleopatra_WC_LAST_CHANGED_DATE "${Kleopatra_WC_LAST_CHANGED_DATE}")
76 set(kleopatra_version "${kleopatra_version}-git${Kleopatra_WC_REVISION} (${Kleopatra_WC_LAST_CHANGED_DATE})")
80 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version-kleopatra.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/version-kleopatra.h)
82 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
83 include (ConfigureChecks.cmake)
85 find_package(Gpgme REQUIRED)
87 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-kleopatra.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kleopatra.h)
89 ${CMAKE_CURRENT_BINARY_DIR}
90 ${CMAKE_CURRENT_SOURCE_DIR}
91 ${CMAKE_CURRENT_BINARY_DIR}/libkleopatraclient/core/
96 if(USABLE_ASSUAN_FOUND)
98 include_directories(${ASSUAN2_INCLUDES})
100 include_directories(${ASSUAN_INCLUDES})
104 add_definitions(-D_ASSUAN_ONLY_GPG_ERRORS)
106 if(CMAKE_COMPILER_IS_GNUCXX)
107 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-braces -Wno-parentheses -Wno-ignored-qualifiers")
110 kde_enable_exceptions()
112 add_subdirectory(pics)
113 add_subdirectory(conf)
115 if(USABLE_ASSUAN_FOUND)
116 # can't use ecm_optional_add_subdirectory here, since it's split
117 # off into ConfigureChecks.cmake..
118 add_subdirectory(libkleopatraclient)
121 add_subdirectory(kwatchgnupg)
124 add_subdirectory(tests)
127 add_subdirectory(kconf_update)
130 set(_kleopatra_extra_uiserver_SRCS uiserver/uiserver_win.cpp)
131 set(_kleopatra_extra_SRCS utils/gnupg-registry.c selftest/registrycheck.cpp)
133 set(_kleopatra_extra_uiserver_SRCS uiserver/uiserver_unix.cpp)
134 set(_kleopatra_extra_SRCS)
137 if(USABLE_ASSUAN_FOUND)
138 set(_kleopatra_uiserver_SRCS
139 uiserver/sessiondata.cpp
140 uiserver/uiserver.cpp
141 ${_kleopatra_extra_uiserver_SRCS}
142 uiserver/assuanserverconnection.cpp
143 uiserver/echocommand.cpp
144 uiserver/decryptverifycommandemailbase.cpp
145 uiserver/decryptverifycommandfilesbase.cpp
146 uiserver/signcommand.cpp
147 uiserver/signencryptfilescommand.cpp
148 uiserver/prepencryptcommand.cpp
149 uiserver/prepsigncommand.cpp
150 uiserver/encryptcommand.cpp
151 uiserver/selectcertificatecommand.cpp
152 uiserver/importfilescommand.cpp
153 uiserver/createchecksumscommand.cpp
154 uiserver/verifychecksumscommand.cpp
156 selftest/uiservercheck.cpp
160 set(_kleopatra_uiserver_extra_libs ${ASSUAN2_LIBRARIES})
163 set(_kleopatra_uiserver_extra_libs ${ASSUAN_VANILLA_LIBRARIES})
165 set(_kleopatra_uiserver_extra_libs ${ASSUAN_PTHREAD_LIBRARIES})
169 if(HAVE_GPG_ERR_SOURCE_KLEO)
170 add_definitions(-DGPG_ERR_SOURCE_DEFAULT=GPG_ERR_SOURCE_KLEO)
172 add_definitions(-DGPG_ERR_SOURCE_DEFAULT=GPG_ERR_SOURCE_USER_1)
176 set(_kleopatra_uiserver_SRCS)
179 ki18n_wrap_ui(_kleopatra_uiserver_SRCS crypto/gui/signingcertificateselectionwidget.ui)
182 utils/gnupg-helper.cpp
183 utils/filesystemwatcher.cpp
185 utils/kdpipeiodevice.cpp
186 utils/kdlogtextwidget.cpp
187 utils/kdsignalblocker.cpp
191 utils/multivalidator.cpp
192 utils/systemtrayicon.cpp
195 utils/path-helper.cpp
202 utils/iodevicelogger.cpp
204 utils/action_data.cpp
206 utils/archivedefinition.cpp
208 utils/clipboardmenu.cpp
210 selftest/selftest.cpp
211 selftest/enginecheck.cpp
212 selftest/gpgconfcheck.cpp
213 selftest/gpgagentcheck.cpp
214 selftest/libkleopatrarccheck.cpp
216 ${_kleopatra_extra_SRCS}
219 models/keylistmodel.cpp
220 models/keylistsortfilterproxymodel.cpp
221 models/subkeylistmodel.cpp
222 models/useridlistmodel.cpp
224 view/keylistcontroller.cpp
229 dialogs/certificateselectiondialog.cpp
230 dialogs/expirydialog.cpp
231 dialogs/lookupcertificatesdialog.cpp
232 dialogs/ownertrustdialog.cpp
233 dialogs/selftestdialog.cpp
234 dialogs/certifycertificatedialog.cpp
235 dialogs/exportsecretkeydialog.cpp
236 dialogs/adduseriddialog.cpp
237 dialogs/certificatedetailsdialog.cpp
238 dialogs/exportcertificatesdialog.cpp
239 dialogs/deletecertificatesdialog.cpp
240 dialogs/setinitialpindialog.cpp
242 crypto/controller.cpp
243 crypto/certificateresolver.cpp
247 crypto/taskcollection.cpp
248 crypto/decryptverifytask.cpp
249 crypto/decryptverifyemailcontroller.cpp
250 crypto/decryptverifyfilescontroller.cpp
251 crypto/encryptemailtask.cpp
252 crypto/encryptemailcontroller.cpp
253 crypto/newsignencryptemailcontroller.cpp
254 crypto/signencryptfilestask.cpp
255 crypto/signencryptfilescontroller.cpp
256 crypto/signemailtask.cpp
257 crypto/signemailcontroller.cpp
258 crypto/createchecksumscontroller.cpp
259 crypto/verifychecksumscontroller.cpp
261 crypto/gui/wizard.cpp
262 crypto/gui/wizardpage.cpp
264 crypto/gui/signingcertificateselectionwidget.cpp
265 crypto/gui/signingcertificateselectiondialog.cpp
267 crypto/gui/resultitemwidget.cpp
268 crypto/gui/resultlistwidget.cpp
269 crypto/gui/resultpage.cpp
271 crypto/gui/newresultpage.cpp
272 crypto/gui/newsignencryptfileswizard.cpp
274 crypto/gui/signencryptemailconflictdialog.cpp
276 crypto/gui/decryptverifyoperationwidget.cpp
277 crypto/gui/decryptverifyfileswizard.cpp
279 crypto/gui/objectspage.cpp
280 crypto/gui/resolverecipientspage.cpp
281 crypto/gui/signerresolvepage.cpp
282 crypto/gui/encryptemailwizard.cpp
283 crypto/gui/signemailwizard.cpp
284 crypto/gui/signencryptfileswizard.cpp
285 crypto/gui/signencryptwizard.cpp
287 crypto/gui/verifychecksumsdialog.cpp
290 commands/gnupgprocesscommand.cpp
291 commands/detailscommand.cpp
292 commands/exportcertificatecommand.cpp
293 commands/importcertificatescommand.cpp
294 commands/importcertificatefromfilecommand.cpp
295 commands/importcertificatefromclipboardcommand.cpp
296 commands/lookupcertificatescommand.cpp
297 commands/reloadkeyscommand.cpp
298 commands/refreshx509certscommand.cpp
299 commands/refreshopenpgpcertscommand.cpp
300 commands/deletecertificatescommand.cpp
301 commands/decryptverifyfilescommand.cpp
302 commands/signencryptfilescommand.cpp
303 commands/encryptclipboardcommand.cpp
304 commands/signclipboardcommand.cpp
305 commands/decryptverifyclipboardcommand.cpp
306 commands/clearcrlcachecommand.cpp
307 commands/dumpcrlcachecommand.cpp
308 commands/dumpcertificatecommand.cpp
309 commands/importcrlcommand.cpp
310 commands/changeexpirycommand.cpp
311 commands/changeownertrustcommand.cpp
312 commands/changeroottrustcommand.cpp
313 commands/changepassphrasecommand.cpp
314 commands/certifycertificatecommand.cpp
315 commands/selftestcommand.cpp
316 commands/exportsecretkeycommand.cpp
317 commands/exportopenpgpcertstoservercommand.cpp
318 commands/adduseridcommand.cpp
319 commands/newcertificatecommand.cpp
320 commands/setinitialpincommand.cpp
321 commands/learncardkeyscommand.cpp
322 commands/checksumcreatefilescommand.cpp
323 commands/checksumverifyfilescommand.cpp
325 ${_kleopatra_uiserver_files}
327 conf/configuredialog.cpp
329 newcertificatewizard/listwidget.cpp
330 newcertificatewizard/newcertificatewizard.cpp
332 smartcard/readerstatus.cpp
336 kleopatraapplication.cpp
341 ecm_qt_declare_logging_category(_kleopatra_SRCS HEADER kleopatra_debug.h IDENTIFIER KLEOPATRA_LOG CATEGORY_NAME log_kleopatra)
344 add_definitions(-DKLEO_MODEL_TEST)
345 set(_kleopatra_SRCS ${_kleopatra_SRCS} models/modeltest.cpp)
348 ki18n_wrap_ui(_kleopatra_SRCS
349 dialogs/certificationoptionswidget.ui
350 dialogs/expirydialog.ui
351 dialogs/lookupcertificatesdialog.ui
352 dialogs/ownertrustdialog.ui
353 dialogs/selectchecklevelwidget.ui
354 dialogs/selftestdialog.ui
355 dialogs/exportsecretkeydialog.ui
356 dialogs/adduseriddialog.ui
357 dialogs/certificatedetailsdialog.ui
358 dialogs/setinitialpindialog.ui
359 newcertificatewizard/listwidget.ui
360 newcertificatewizard/chooseprotocolpage.ui
361 newcertificatewizard/enterdetailspage.ui
362 newcertificatewizard/overviewpage.ui
363 newcertificatewizard/keycreationpage.ui
364 newcertificatewizard/resultpage.ui
365 newcertificatewizard/advancedsettingsdialog.ui
368 kconfig_add_kcfg_files(_kleopatra_SRCS
369 kcfg/tooltippreferences.kcfgc
370 kcfg/emailoperationspreferences.kcfgc
371 kcfg/fileoperationspreferences.kcfgc
372 kcfg/smimevalidationpreferences.kcfgc
376 file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/icons/*-apps-kleopatra.png")
377 ecm_add_app_icon(_kleopatra_SRCS ICONS ${ICONS_SRCS})
379 qt5_add_resources(_kleopatra_SRCS kleopatra.qrc)
381 add_executable(kleopatra_bin ${_kleopatra_SRCS} ${_kleopatra_uiserver_SRCS})
382 set_target_properties(kleopatra_bin PROPERTIES OUTPUT_NAME kleopatra)
384 target_link_libraries(kleopatra_bin
385 ${_kleopatra_extra_libs}
395 ${_kleopatra_uiserver_extra_libs}
399 if(USABLE_ASSUAN_FOUND)
400 target_link_libraries(kleopatra_bin )
403 install(TARGETS kleopatra_bin ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
406 PROGRAMS data/org.kde.kleopatra.desktop data/kleopatra_import.desktop
407 DESTINATION ${KDE_INSTALL_APPDIR}
409 install(FILES data/kleopatra.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
411 FILES data/kleopatra_signencryptfiles.desktop
412 data/kleopatra_signencryptfolders.desktop
413 data/kleopatra_decryptverifyfiles.desktop
414 data/kleopatra_decryptverifyfolders.desktop
415 DESTINATION ${KDE_INSTALL_KSERVICES5DIR}
418 add_subdirectory(icons)