2 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
5 # Due to QtMain linking
6 cmake_minimum_required(VERSION 2.8.11)
8 cmake_policy(SET CMP0020 NEW)
11 # The Qt5's qt5_use_modules is only available on 2.8.9 or later -- sweet, isn't it?
12 cmake_minimum_required(VERSION 2.8.9)
14 cmake_minimum_required(VERSION 2.8.7)
18 # Silence warnings in TrojitaOption.cmake; we are fine with only doing the
20 cmake_policy(SET CMP0054 NEW)
24 # We make use of CMAKE_CXXFLAGS_DEBUG...
25 cmake_policy(SET CMP0043 OLD)
28 # Set a default build type if none was specified. This was shamelessly stolen
29 # from VTK's cmake setup because these guys produce both CMake and a project that
30 # manipulates this variable, and the web is full of posts where people say that
31 # it is apparently evil to just set the build type in a way an earlier version of
32 # this patch did. Oh, and the location of this check/update matters, apparently.
34 # Yes, this is just plain crazy.
35 if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
36 message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
37 set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
38 # Set the possible values of build type for cmake-gui
39 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
42 # POSITION_INDEPENDENT_CODE is only available on cmake 2.8.9 or later
43 # Add needed flags for supported compilers which simulate POSITION_INDEPENDENT_CODE property
44 if(CMAKE_VERSION VERSION_LESS "2.8.9")
45 if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
46 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
48 message(FATAL_ERROR "Needs GNU or Clang C++ compiler or CMake 2.8.9 (or later)")
51 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
54 include(FindCXXFeatures)
55 if(NOT CXXFeatures_auto_FOUND)
56 message(SEND_ERROR "Your compiler doesn't support C++11's auto")
58 if(NOT CXXFeatures_static_assert_FOUND)
59 message(SEND_ERROR "Your compiler doesn't support C++11's static_assert")
61 if(NOT CXXFeatures_alignof_FOUND)
62 if(NOT CMAKE_COMPILER_IS_GNUCXX AND NOT MSVC)
63 message(SEND_ERROR "Your compiler doesn't support C++11's alignof and it also isn't gcc or MSVC. Either would work.")
66 if(NOT CXXFeatures_nullptr_FOUND)
67 # Yes, this is extremely fragile; it will break on any code which wants to
68 # distinguish between an int and nullptr_t. So far, we don't have anything
69 # like that in Trojita. Let's just pretend that it won't ever happen, and
70 # if it happens, then let's hope that an "ambiguous overload" would come up.
71 add_definitions(-Dnullptr=0)
72 message(WARNING "Your C++ compiler doesn't support C++11's nullptr. Activating a very hackish workaround "
73 "which can break existing code because nullptr is not plain 0.")
75 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_COMPILER_FLAGS}")
77 include(TrojitaOption)
79 trojita_option(WITH_DESKTOP "Build desktop version" ON)
80 trojita_option(WITH_QT5 "Build with Qt5 library" ON)
81 trojita_option(WITH_DBUS "Build with DBus library" AUTO)
82 trojita_option(WITH_RAGEL "Build with Ragel library" AUTO)
83 trojita_option(WITH_ZLIB "Build with zlib library" AUTO)
84 trojita_option(WITH_SHARED_PLUGINS "Enable shared dynamic plugins" ON)
85 trojita_option(WITH_KDE "Enable KDE support" AUTO "WITH_DESKTOP;NOT WITH_QT5;WITH_DBUS")
86 trojita_option(WITH_TESTS "Build tests" ON)
89 trojita_option(WITH_NSIS "Build Windows NSIS installer" AUTO "WITH_DESKTOP")
92 if(UNIX AND NOT APPLE)
93 set(QTKEYCHAIN_DEPENDS ";WITH_DBUS")
95 set(QTKEYCHAIN_DEPENDS "")
99 message(STATUS "Building the Qt5 version")
100 find_package(Qt5Core 5.2 REQUIRED)
101 find_package(Qt5Gui REQUIRED)
102 find_package(Qt5Network REQUIRED)
103 find_package(Qt5Sql REQUIRED)
104 find_package(Qt5WebKitWidgets REQUIRED)
105 find_package(Qt5Widgets REQUIRED)
106 find_package(Qt5LinguistTools)
107 trojita_find_package(Qt5DBus "" "http://qt-project.org" "Qt5 D-Bus support" "Needed for IPC and for some plugins" WITH_DBUS)
108 trojita_find_package(Qt5Test "" "http://qt-project.org" "Qt5 QTest library" "Needed for automated tests" WITH_TESTS)
109 if(Qt5LinguistTools_FOUND)
110 find_package(Qt5LinguistForTrojita)
113 message(STATUS "Building the Qt4 version")
114 set(QT_USE_QTNETWORK 1)
116 set(QT_USE_QTWEBKIT 1)
123 trojita_find_package(Qt4 4.6 "http://qt-project.org" "Qt4" "Needed for building" REQUIRED)
124 include(${QT_USE_FILE})
125 trojita_check_qt4_module(QTCORE REQUIRED)
126 trojita_check_qt4_module(QTGUI REQUIRED)
127 trojita_check_qt4_module(QTNETWORK REQUIRED)
128 trojita_check_qt4_module(QTSQL REQUIRED)
129 trojita_check_qt4_module(QTWEBKIT REQUIRED)
130 trojita_check_qt4_module(QTDBUS WITH_DBUS)
131 trojita_check_qt4_module(QTTEST WITH_TESTS)
132 trojita_find_package(LinguistForTrojita "" "" "" "")
133 if(NOT QT_QCONFIG MATCHES "openssl" OR QT_QCONFIG MATCHES "no-openssl")
134 message(FATAL_ERROR "Your copy of Qt was build without SSL support. Please get openssl and rebuild Qt or a Qt binary with SSL support compiled in")
138 trojita_plugin_option(WITH_ABOOKADDRESSBOOK_PLUGIN "Build AbookAddressbook plugin" STATIC)
139 trojita_plugin_option(WITH_CLEARTEXT_PLUGIN "Build Cleartext password plugin" STATIC)
140 trojita_plugin_option(WITH_QTKEYCHAIN_PLUGIN "Build Qtkeychain password plugin" "${QTKEYCHAIN_DEPENDS}")
141 trojita_plugin_option(WITH_KRESOURCE_PLUGIN "Build KDE Kresource addressbook plugin" "WITH_KDE")
142 trojita_plugin_option(WITH_AKONADI_PLUGIN "Build KDE Akonadi addressbook plugin" "WITH_KDE")
144 trojita_find_package(Git "" "" "" "")
147 trojita_find_package(MakeNSIS "" "http://nsis.sourceforge.net" "Nullsoft Scriptable Install System" "Needed for building Windows installer" WITH_NSIS)
150 # Add support for Mingw RC compiler
153 include(CMakeDetermineRCCompiler)
156 set(CMAKE_RC_COMPILER_INIT windres)
157 set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
162 trojita_find_package(Qt5Keychain QUIET "https://github.com/frankosterfeld/qtkeychain" "QtKeychain library (Qt5 version)" "Needed for QtKeychain password plugin" WITH_QTKEYCHAIN_PLUGIN)
164 trojita_find_package(QtKeychain QUIET "https://github.com/frankosterfeld/qtkeychain" "QtKeychain library" "Needed for QtKeychain password plugin" WITH_QTKEYCHAIN_PLUGIN)
166 if(Qt5Keychain_FOUND OR QtKeychain_FOUND)
167 message(STATUS "Found QtKeychain library (includes at ${QTKEYCHAIN_INCLUDE_DIRS}, lib at ${QTKEYCHAIN_LIBRARIES})")
169 message(STATUS "Could not find QtKeychain library")
173 # Store cmake variables which FindKDE4.cmake changes
174 set(OLD_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH})
175 set(OLD_EXECUTABLE_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
176 set(OLD_CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS})
177 set(OLD_CMAKE_MODULE_LINKER_FLAGS ${CMAKE_MODULE_LINKER_FLAGS})
179 trojita_find_package(KDE4 "" "http://www.kde.org/" "KDE4 libraries" "Needed for KDE plugins" WITH_KDE)
181 # KDE4_DATA_DIR is set when KDE4 is found
183 include(KDE4Defaults)
185 # FindKDE4.cmake disables c++ exceptions, need to reenable them for compiling trojita
186 add_definitions(${KDE4_ENABLE_EXCEPTIONS})
188 # FindKDE4.cmake changes cmake output paths and some linker flags which cause that some (KDE too) plugins do not compile, change them back to defaults
189 set(LIBRARY_OUTPUT_PATH ${OLD_LIBRARY_OUTPUT_PATH})
190 set(EXECUTABLE_OUTPUT_PATH ${OLD_EXECUTABLE_OUTPUT_PATH})
191 set(CMAKE_SHARED_LINKER_FLAGS ${OLD_CMAKE_SHARED_LINKER_FLAGS})
192 set(CMAKE_MODULE_LINKER_FLAGS ${OLD_CMAKE_MODULE_LINKER_FLAGS})
196 # Akonadi was added to KdepimLibs 4.5
197 if(WITH_AKONADI_PLUGIN)
198 set(KdepimLibsVersion 4.5)
200 set(KdepimLibsVersion)
202 trojita_find_package(KdepimLibs "${KdepimLibsVersion}" "http://www.kde.org/" "KdepimLibs libraries" "Needed for KDE Kresource and Akonadi addressbook plugins" WITH_AKONADI_PLUGIN WITH_KRESOURCE_PLUGIN)
204 if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
205 set(CMAKE_INSTALL_LIBDIR "lib${LIB_SUFFIX}")
207 mark_as_advanced(CMAKE_INSTALL_LIBDIR)
209 if(NOT CMAKE_INSTALL_PLUGIN_DIR)
210 set(CMAKE_INSTALL_PLUGIN_DIR "${CMAKE_INSTALL_LIBDIR}/trojita")
212 mark_as_advanced(CMAKE_INSTALL_PLUGIN_DIR)
215 if(IS_ABSOLUTE ${CMAKE_INSTALL_PLUGIN_DIR})
216 set(PLUGIN_DIR "${CMAKE_INSTALL_PLUGIN_DIR}")
218 set(PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_PLUGIN_DIR}")
221 mark_as_advanced(PLUGIN_DIR)
223 include(GNUInstallDirs)
225 # When manipulating CXXFLAGS, we put the user's CXXFLAGS *after* that so that they take priority.
227 # See below for some reationale for these optimizations
228 set(CMAKE_CXX_FLAGS "/O2 ${CMAKE_CXX_FLAGS}")
230 # We have no information about the warnings and their usefullness. Reports are welcome.
231 # We might enable warnings on MSVC in future.
233 # -Werror is not a default for sanity reasons (one cannot know what warnings a future compiler
234 # might bring along), but it's a default in debug mode. The idea is that developers should care
235 # about a warning-free build, and that this is easier than messing with yet another configure option.
236 set(CMAKE_CXX_FLAGS_DEBUG "-Werror ${CMAKE_CXX_FLAGS_DEBUG}")
237 # Also see CMP0043...
239 # Optimizations are enabled unconditionally because they make a big difference in the speed of the
240 # resulting binaries, and that it is better to allow an opt-out from them by adjusting CXXFLAGS through
241 # an env var at cmake time if needed.
242 # The reason for not manipulating just CMAKE_CXX_FLAGS_DEBUG is that unrecognized build types ("DebugFull")
243 # should still benefit from these optimizations. Yup, it would be even better if CMake did a sane thing
244 # and warned when users set an unrecognized and unused build type, but that just isn't the case.
245 set(CMAKE_CXX_FLAGS "-O2 ${CMAKE_CXX_FLAGS}")
247 # Build warnings are useful tools (and Trojita should be warning-free anyway), enable them on all
248 # configurations. They are warnings, not errors.
249 set(CMAKE_CXX_FLAGS "-Wall -Wsign-compare ${CMAKE_CXX_FLAGS}")
252 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
253 # The following is required so that the moc_*.cpp and ui_*.h are found
254 include_directories(${CMAKE_CURRENT_BINARY_DIR})
255 add_definitions(-DQT_STRICT_ITERATORS)
258 add_definitions(-DQT_USE_QSTRINGBUILDER)
259 add_definitions(-DQT_USE_FAST_OPERATOR_PLUS)
260 add_definitions(-DQT_USE_FAST_CONCATENATION)
263 # Make sure that plugins not export all symbols, only that which are explicitly marked
264 include(GenerateExportHeader)
265 add_compiler_export_flags()
267 if(NOT WITH_QT5 AND CMAKE_VERSION VERSION_LESS 2.8.10)
268 set(SUPPORTS_TARGET_INCLUDES 0)
270 ${QT_MKSPECS_DIR}/default
271 ${CMAKE_CURRENT_SOURCE_DIR}/src/Gui/
272 ${CMAKE_CURRENT_SOURCE_DIR}/src/mimetypes-qt4/io/
273 ${CMAKE_CURRENT_SOURCE_DIR}/tests
274 ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_LibMailboxSync)
276 set(SUPPORTS_TARGET_INCLUDES 1)
279 set(CMAKE_AUTOMOC True)
281 trojita_find_package(RagelForTrojita "" "" "" "" WITH_RAGEL)
283 if(WIN32) # Check if we are on Windows
284 # On win32, qt can statically link to zlib and export their symbols.
285 # We check if we can find the string " zlib " in the QT_CONFIG list in
286 # ${QT_MKSPECS_DIR}/qconfig.pri and include on success ${QT_QTCORE_LIBRARY}
287 # and ${QTDIR}/src/3rdparty/zlib as lib and include folder
289 message(STATUS "We are on Windows with Qt. Checking if zlib is built into Qt")
291 if(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
292 file(READ ${QT_MKSPECS_DIR}/qconfig.pri _qconfig_FILE_contents_ZLIB_CHECK)
293 string(REGEX MATCH "QT_CONFIG[^\n]+" QT_CONFIG_ZLIB_CHECK ${_qconfig_FILE_contents_ZLIB_CHECK})
295 set(ENV_QTDIR $ENV{QTDIR})
296 if(NOT DEFINED ENV_QTDIR)
297 message(STATUS "QTDIR not specified in environment, will not use zlib")
298 elseif(QT_CONFIG_ZLIB_CHECK)
299 if(QT_CONFIG_ZLIB_CHECK MATCHES " zlib ")
300 message(STATUS "Found zlib in QT_QCONFIG. zlib seems to be built into Qt")
301 set(ZLIB_LIBRARY_RELEASE ${QT_QTCORE_LIBRARY_RELEASE})
302 set(ZLIB_LIBRARY_DEBUG ${QT_QTCORE_LIBRARY_DEBUG})
303 set(ZLIB_LIBRARY ${QT_QTCORE_LIBRARY})
305 string(REGEX REPLACE "\\\\" "/" QTDIR ${ENV_QTDIR})
306 set(ZLIB_INCLUDE_DIR "${QTDIR}/src/3rdparty/zlib")
309 set(ZLIB_LIBRARIES ${ZLIB_LIBRARY} )
310 mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR ZLIB_FOUND)
311 else(QT_CONFIG_ZLIB_CHECK MATCHES " zlib ")
312 message(STATUS "Could not determine if Qt was built with zlib support.")
313 endif(QT_CONFIG_ZLIB_CHECK MATCHES " zlib ")
316 endif(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
317 endif(QT_QTCORE_FOUND)
321 trojita_find_package(ZLIB "" "" "" "" WITH_ZLIB)
325 set(TROJITA_HAVE_ZLIB True)
326 message(STATUS "Support for COMPRESS=DEFLATE enabled")
328 set(TROJITA_HAVE_ZLIB False)
329 message(STATUS "Disabling COMPRESS=DEFLATE, zlib is not available")
332 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/configure.cmake.in
333 ${CMAKE_CURRENT_BINARY_DIR}/configure.cmake.h)
335 feature_summary(FATAL_ON_MISSING_REQUIRED_PACKAGES INCLUDE_QUIET_PACKAGES DESCRIPTION "\n" WHAT ALL)
337 set(path_Common ${CMAKE_CURRENT_SOURCE_DIR}/src/Common)
338 set(libCommon_SOURCES
339 ${path_Common}/Application.cpp
340 ${path_Common}/ConnectionId.cpp
341 ${path_Common}/DeleteAfter.cpp
342 ${path_Common}/FileLogger.cpp
343 ${path_Common}/MetaTypes.cpp
344 ${path_Common}/Paths.cpp
345 ${path_Common}/SettingsNames.cpp
348 set(path_Plugins ${CMAKE_CURRENT_SOURCE_DIR}/src/Plugins)
349 set(libPlugins_SOURCES
350 ${path_Plugins}/AddressbookPlugin.cpp
351 ${path_Plugins}/PasswordPlugin.cpp
352 ${path_Plugins}/PluginJob.cpp
353 ${path_Plugins}/PluginManager.cpp
356 set(path_UiUtils ${CMAKE_CURRENT_SOURCE_DIR}/src/UiUtils)
357 set(libUiUtils_SOURCES
358 ${path_UiUtils}/Color.cpp
359 ${path_UiUtils}/Formatting.cpp
360 ${path_UiUtils}/IconLoader.cpp
361 ${path_UiUtils}/PasswordWatcher.cpp
362 ${path_UiUtils}/PlainTextFormatter.cpp
365 set(path_IPC ${CMAKE_CURRENT_SOURCE_DIR}/src/IPC)
369 ${path_IPC}/DBusInterface.cpp
370 ${path_IPC}/MainWindowBridge.cpp
378 set(path_Composer ${CMAKE_CURRENT_SOURCE_DIR}/src/Composer)
379 set(libComposer_SOURCES
380 ${path_Composer}/ComposerAttachments.cpp
381 ${path_Composer}/Mailto.cpp
382 ${path_Composer}/MessageComposer.cpp
383 ${path_Composer}/QuoteText.cpp
384 ${path_Composer}/Recipients.cpp
385 ${path_Composer}/ReplaceSignature.cpp
386 ${path_Composer}/SenderIdentitiesModel.cpp
387 ${path_Composer}/SubjectMangling.cpp
388 ${path_Composer}/Submission.cpp
391 set(path_MSA ${CMAKE_CURRENT_SOURCE_DIR}/src/MSA)
393 ${path_MSA}/AbstractMSA.cpp
394 ${path_MSA}/Account.cpp
395 ${path_MSA}/FakeMSA.cpp
396 ${path_MSA}/ImapSubmit.cpp
398 ${path_MSA}/Sendmail.cpp
401 set(path_Streams ${CMAKE_CURRENT_SOURCE_DIR}/src/Streams)
402 set(libStreams_SOURCES
403 ${path_Streams}/DeletionWatcher.cpp
404 ${path_Streams}/FakeSocket.cpp
405 ${path_Streams}/IODeviceSocket.cpp
406 ${path_Streams}/Socket.cpp
407 ${path_Streams}/SocketFactory.cpp
411 set(libStreams_SOURCES ${libStreams_SOURCES}
412 ${path_Streams}/3rdparty/rfc1951.cpp)
413 include_directories(${ZLIB_INCLUDE_DIR})
417 set(path_mimetypesqt4 ${CMAKE_CURRENT_SOURCE_DIR}/src/mimetypes-qt4)
418 set(libMimetypesQt4_SOURCES
419 ${path_mimetypesqt4}/io/qstandardpaths.cpp
420 ${path_mimetypesqt4}/mimetypes/qmimedatabase.cpp
421 ${path_mimetypesqt4}/mimetypes/qmimeglobpattern.cpp
422 ${path_mimetypesqt4}/mimetypes/qmimemagicrule.cpp
423 ${path_mimetypesqt4}/mimetypes/qmimemagicrulematcher.cpp
424 ${path_mimetypesqt4}/mimetypes/qmimetype.cpp
425 ${path_mimetypesqt4}/mimetypes/qmimetypeparser.cpp
426 ${path_mimetypesqt4}/mimetypes/qmimeprovider.cpp
429 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
430 ${path_mimetypesqt4}/io/qstandardpaths_win.cpp)
432 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
433 ${path_mimetypesqt4}/io/qstandardpaths_mac.cpp)
435 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
436 ${path_mimetypesqt4}/io/qstandardpaths_os2.cpp)
438 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
439 ${path_mimetypesqt4}/io/qstandardpaths_unix.cpp)
441 message(FATAL_ERROR "Unsupported platform -- mimetypes-Qt4 support only Unix, MacOSX, Windows and OS/2")
445 set(path_DesktopGui ${CMAKE_CURRENT_SOURCE_DIR}/src/Gui)
446 set(libDesktopGui_SOURCES
447 ${path_DesktopGui}/AddressRowWidget.cpp
448 ${path_DesktopGui}/AttachmentView.cpp
449 ${path_DesktopGui}/CompleteMessageWidget.cpp
450 ${path_DesktopGui}/ComposeWidget.cpp
451 ${path_DesktopGui}/ComposerAttachmentsList.cpp
452 ${path_DesktopGui}/ComposerTextEdit.cpp
453 ${path_DesktopGui}/EmbeddedWebView.cpp
454 ${path_DesktopGui}/EnvelopeView.cpp
455 ${path_DesktopGui}/ExternalElementsWidget.cpp
456 ${path_DesktopGui}/FindBar.cpp
457 ${path_DesktopGui}/FlowLayout.cpp
458 ${path_DesktopGui}/FromAddressProxyModel.cpp
459 ${path_DesktopGui}/LineEdit.cpp
460 ${path_DesktopGui}/LoadablePartWidget.cpp
461 ${path_DesktopGui}/MailBoxTreeView.cpp
462 ${path_DesktopGui}/MessageListWidget.cpp
463 ${path_DesktopGui}/MessageSourceWidget.cpp
464 ${path_DesktopGui}/MessageView.cpp
465 ${path_DesktopGui}/MsgListView.cpp
466 ${path_DesktopGui}/OnePanelAtTimeWidget.cpp
467 ${path_DesktopGui}/OneEnvelopeAddress.cpp
468 ${path_DesktopGui}/OverlayWidget.cpp
469 ${path_DesktopGui}/PartWalker.cpp
470 ${path_DesktopGui}/PartWidget.cpp
471 ${path_DesktopGui}/PartWidgetFactoryVisitor.cpp
472 ${path_DesktopGui}/PasswordDialog.cpp
473 ${path_DesktopGui}/ProgressPopUp.cpp
474 ${path_DesktopGui}/ProtocolLoggerWidget.cpp
475 ${path_DesktopGui}/ReplaceCharValidator.cpp
476 ${path_DesktopGui}/SettingsDialog.cpp
477 ${path_DesktopGui}/SimplePartWidget.cpp
478 ${path_DesktopGui}/Spinner.cpp
479 ${path_DesktopGui}/TagListWidget.cpp
480 ${path_DesktopGui}/TagWidget.cpp
481 ${path_DesktopGui}/TaskProgressIndicator.cpp
482 ${path_DesktopGui}/UserAgentWebPage.cpp
483 ${path_DesktopGui}/Util.cpp
484 ${path_DesktopGui}/Window.cpp
485 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigDialog.cpp
486 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigWidget.cpp
487 ${path_DesktopGui}/ShortcutHandler/ShortcutHandler.cpp
490 ${path_DesktopGui}/AboutDialog.ui
491 ${path_DesktopGui}/ComposeWidget.ui
492 ${path_DesktopGui}/CreateMailboxDialog.ui
493 ${path_DesktopGui}/EditIdentity.ui
494 ${path_DesktopGui}/PasswordDialog.ui
495 ${path_DesktopGui}/ProgressPopUp.ui
496 ${path_DesktopGui}/SettingsCachePage.ui
497 ${path_DesktopGui}/SettingsGeneralPage.ui
498 ${path_DesktopGui}/SettingsImapPage.ui
499 ${path_DesktopGui}/SettingsOutgoingPage.ui
500 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigWidget.ui
502 set(libDesktopGui_RESOURCES
503 ${CMAKE_CURRENT_SOURCE_DIR}/src/icons.qrc
504 ${CMAKE_CURRENT_SOURCE_DIR}/src/license.qrc
507 set(libqwwsmtpclient_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/qwwsmtpclient/qwwsmtpclient.cpp)
509 set(libAppVersion_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/AppVersion/SetCoreApplication.cpp)
511 set(path_Imap ${CMAKE_CURRENT_SOURCE_DIR}/src/Imap)
513 ${path_Imap}/ConnectionState.cpp
514 ${path_Imap}/Encoders.cpp
515 ${path_Imap}/Exceptions.cpp
516 ${path_Imap}/Parser/3rdparty/kcodecs.cpp
517 ${path_Imap}/Parser/3rdparty/rfccodecs.cpp
519 ${path_Imap}/Parser/Command.cpp
520 ${path_Imap}/Parser/Data.cpp
521 ${path_Imap}/Parser/LowLevelParser.cpp
522 ${path_Imap}/Parser/MailAddress.cpp
523 ${path_Imap}/Parser/Message.cpp
524 ${path_Imap}/Parser/Parser.cpp
525 ${path_Imap}/Parser/Response.cpp
526 ${path_Imap}/Parser/Sequence.cpp
527 ${path_Imap}/Parser/ThreadingNode.cpp
529 ${path_Imap}/Network/FileDownloadManager.cpp
530 ${path_Imap}/Network/ForbiddenReply.cpp
531 ${path_Imap}/Network/MsgPartNetAccessManager.cpp
532 ${path_Imap}/Network/MsgPartNetworkReply.cpp
533 ${path_Imap}/Network/QQuickNetworkReplyWrapper.cpp
535 ${path_Imap}/Model/Cache.cpp
536 ${path_Imap}/Model/CombinedCache.cpp
537 ${path_Imap}/Model/DragAndDrop.cpp
538 ${path_Imap}/Model/DiskPartCache.cpp
539 ${path_Imap}/Model/DummyNetworkWatcher.cpp
540 ${path_Imap}/Model/FindInterestingPart.cpp
541 ${path_Imap}/Model/FlagsOperation.cpp
542 ${path_Imap}/Model/FullMessageCombiner.cpp
543 ${path_Imap}/Model/ImapAccess.cpp
544 ${path_Imap}/Model/MailboxFinder.cpp
545 ${path_Imap}/Model/MailboxMetadata.cpp
546 ${path_Imap}/Model/MailboxModel.cpp
547 ${path_Imap}/Model/MailboxTree.cpp
548 ${path_Imap}/Model/MemoryCache.cpp
549 ${path_Imap}/Model/Model.cpp
550 ${path_Imap}/Model/MsgListModel.cpp
551 ${path_Imap}/Model/NetworkWatcher.cpp
552 ${path_Imap}/Model/OneMessageModel.cpp
553 ${path_Imap}/Model/ParserState.cpp
554 ${path_Imap}/Model/PrettyMailboxModel.cpp
555 ${path_Imap}/Model/PrettyMsgListModel.cpp
556 ${path_Imap}/Model/SpecialFlagNames.cpp
557 ${path_Imap}/Model/SQLCache.cpp
558 ${path_Imap}/Model/SubtreeModel.cpp
559 ${path_Imap}/Model/SystemNetworkWatcher.cpp
560 ${path_Imap}/Model/TaskFactory.cpp
561 ${path_Imap}/Model/TaskPresentationModel.cpp
562 ${path_Imap}/Model/ThreadingMsgListModel.cpp
563 ${path_Imap}/Model/Utils.cpp
564 ${path_Imap}/Model/VisibleTasksModel.cpp
566 # The ModelTest is only needed when debugging manually
567 #${path_Imap}/Model/ModelTest/modeltest.cpp
568 # The ModelWatcher is another debugging aid
569 ${path_Imap}/Model/ModelWatcher.cpp
571 ${path_Imap}/Model/kdeui-itemviews/kdescendantsproxymodel.cpp
573 ${path_Imap}/Tasks/AppendTask.cpp
574 ${path_Imap}/Tasks/CopyMoveMessagesTask.cpp
575 ${path_Imap}/Tasks/CreateMailboxTask.cpp
576 ${path_Imap}/Tasks/DeleteMailboxTask.cpp
577 ${path_Imap}/Tasks/EnableTask.cpp
578 ${path_Imap}/Tasks/ExpungeMailboxTask.cpp
579 ${path_Imap}/Tasks/ExpungeMessagesTask.cpp
580 ${path_Imap}/Tasks/Fake_ListChildMailboxesTask.cpp
581 ${path_Imap}/Tasks/Fake_OpenConnectionTask.cpp
582 ${path_Imap}/Tasks/FetchMsgMetadataTask.cpp
583 ${path_Imap}/Tasks/FetchMsgPartTask.cpp
584 ${path_Imap}/Tasks/GenUrlAuthTask.cpp
585 ${path_Imap}/Tasks/GetAnyConnectionTask.cpp
586 ${path_Imap}/Tasks/IdTask.cpp
587 ${path_Imap}/Tasks/IdleLauncher.cpp
588 ${path_Imap}/Tasks/ImapTask.cpp
589 ${path_Imap}/Tasks/KeepMailboxOpenTask.cpp
590 ${path_Imap}/Tasks/ListChildMailboxesTask.cpp
591 ${path_Imap}/Tasks/NoopTask.cpp
592 ${path_Imap}/Tasks/NumberOfMessagesTask.cpp
593 ${path_Imap}/Tasks/ObtainSynchronizedMailboxTask.cpp
594 ${path_Imap}/Tasks/OfflineConnectionTask.cpp
595 ${path_Imap}/Tasks/OpenConnectionTask.cpp
596 ${path_Imap}/Tasks/SortTask.cpp
597 ${path_Imap}/Tasks/SubscribeUnsubscribeTask.cpp
598 ${path_Imap}/Tasks/ThreadTask.cpp
599 ${path_Imap}/Tasks/UidSubmitTask.cpp
600 ${path_Imap}/Tasks/UnSelectTask.cpp
601 ${path_Imap}/Tasks/UpdateFlagsTask.cpp
602 ${path_Imap}/Tasks/UpdateFlagsOfAllMessagesTask.cpp
606 message(STATUS "Using Ragel for the RFC 5322 parser")
607 ragel_parser(${path_Imap}/Parser/Rfc5322HeaderParser.cpp)
608 set(libImap_SOURCES ${libImap_SOURCES}
609 ${CMAKE_CURRENT_BINARY_DIR}/Rfc5322HeaderParser.generated.cpp)
611 message(STATUS "Using pregenerated RFC 5322 parser")
612 set(libImap_SOURCES ${libImap_SOURCES}
613 ${path_Imap}/Parser/Rfc5322HeaderParser.generated.cpp)
616 set(trojita_desktop_SOURCES
617 ${path_DesktopGui}/main.cpp
621 list(APPEND trojita_desktop_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/trojita_win32.rc)
622 set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/trojita_win32.rc APPEND PROPERTY OBJECT_DEPENDS
623 ${CMAKE_CURRENT_SOURCE_DIR}/src/icons/trojita.ico
624 ${CMAKE_CURRENT_BINARY_DIR}/trojita-git-version.h
625 ${CMAKE_CURRENT_BINARY_DIR}/trojita-version.h
629 if(LinguistForTrojita_FOUND OR Qt5LinguistForTrojita_FOUND)
630 file(GLOB_RECURSE lang_PO "${CMAKE_CURRENT_SOURCE_DIR}/po/trojita_common_*.po")
632 qt5_wrap_po(trojita_QM ${lang_PO})
634 qt4_wrap_po(trojita_QM ${lang_PO})
636 set(language_summary "")
637 foreach(po ${lang_PO})
638 string(REGEX REPLACE "^(.*)/trojita_common_(.*).po" "\\2" lang ${po})
639 list(APPEND language_summary ${lang})
641 list(SORT language_summary)
642 list(LENGTH language_summary num_languages)
644 message(STATUS "Available languages: ${language_summary}")
646 install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/locale/ DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/trojita/locale" REGEX "(x_test)|(.*\\.ts)" EXCLUDE)
649 message(STATUS "No .po files found, will not install any languages")
652 message(STATUS "Qt Linguist (lupdate/lrelease/lconvert) not found, disabling localization support")
655 set(version_files ${CMAKE_CURRENT_BINARY_DIR}/trojita-version.h ${CMAKE_CURRENT_BINARY_DIR}/trojita-git-version.h)
657 set(version_files ${version_files} ${CMAKE_CURRENT_BINARY_DIR}/trojita-version.nsi)
661 add_custom_target(version DEPENDS version_fake_file)
662 add_custom_command(OUTPUT version_fake_file ${version_files}
663 COMMAND ${CMAKE_COMMAND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DNSIS=${NSIS} -DHOST_ARCH=${HOST_ARCH} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/TrojitaVersion.cmake)
664 set_source_files_properties(${version_files}
665 PROPERTIES GENERATED TRUE
666 HEADER_FILE_ONLY TRUE)
668 add_library(Common STATIC ${libCommon_SOURCES})
669 set_property(TARGET Common APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
670 add_dependencies(Common version)
671 target_link_libraries(Common ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
673 add_library(AppVersion STATIC ${libAppVersion_SOURCES})
674 set_property(TARGET AppVersion APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
675 add_dependencies(AppVersion version)
676 target_link_libraries(AppVersion Common ${QT_QTCORE_LIBRARY})
678 if(WITH_SHARED_PLUGINS)
679 add_library(Plugins SHARED ${libPlugins_SOURCES})
681 add_library(Plugins STATIC ${libPlugins_SOURCES})
682 set_property(TARGET Plugins APPEND PROPERTY COMPILE_DEFINITIONS QT_STATICPLUGIN)
684 set_target_properties(Plugins PROPERTIES OUTPUT_NAME trojita_plugins)
685 set_property(TARGET Plugins APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
687 qt5_use_modules(Plugins Core)
689 target_link_libraries(Plugins ${QT_QTCORE_LIBRARY})
692 add_library(UiUtils STATIC ${libUiUtils_SOURCES})
693 set_property(TARGET UiUtils APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
694 target_link_libraries(UiUtils Plugins Common ${QT_QTCORE_LIBRARY})
696 add_library(Streams STATIC ${libStreams_SOURCES})
697 set_property(TARGET Streams APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
698 target_link_libraries(Streams ${QT_QTNETWORK_LIBRARY} ${QT_QTCORE_LIBRARY})
700 target_link_libraries(Streams ${ZLIB_LIBRARIES})
703 add_library(IPC STATIC ${libIPC_SOURCES})
704 set_property(TARGET IPC APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
706 target_link_libraries(IPC ${QT_QTDBUS_LIBRARY})
708 qt5_use_modules(IPC DBus Widgets)
712 qt5_use_modules(IPC Core)
716 add_library(qwwsmtpclient STATIC ${libqwwsmtpclient_SOURCES})
717 target_link_libraries(qwwsmtpclient ${QT_QTNETWORK_LIBRARY} ${QT_QTCORE_LIBRARY})
719 add_library(MSA STATIC ${libMSA_SOURCES})
720 set_property(TARGET MSA APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
721 target_link_libraries(MSA Imap Streams qwwsmtpclient ${QT_QTCORE_LIBRARY})
723 add_library(Composer STATIC ${libComposer_SOURCES})
724 set_property(TARGET Composer APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
725 target_link_libraries(Composer Common MSA Streams UiUtils qwwsmtpclient ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
727 target_link_libraries(Composer MimetypesQt4)
730 add_library(Imap STATIC ${libImap_SOURCES})
731 set_property(TARGET Imap APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
732 target_link_libraries(Imap Common Streams UiUtils ${QT_QTNETWORK_LIBRARY} ${QT_QTSQL_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
734 target_link_libraries(Imap ${ZLIB_LIBRARIES})
738 add_library(MimetypesQt4 STATIC ${libMimetypesQt4_SOURCES})
739 if(SUPPORTS_TARGET_INCLUDES)
740 set_property(TARGET MimetypesQt4 APPEND PROPERTY INCLUDE_DIRECTORIES
741 ${QT_MKSPECS_DIR}/default ${path_mimetypesqt4}/io/)
743 target_link_libraries(MimetypesQt4 ${QT_QTCORE_LIBRARY})
745 find_library(CARBON_LIBRARY Carbon REQUIRED)
746 target_link_libraries(MimetypesQt4 ${CARBON_LIBRARY})
750 ## ClearText password plugin
751 if(WITH_CLEARTEXT_PLUGIN)
752 trojita_add_plugin(trojita_plugin_ClearTextPasswordPlugin WITH_CLEARTEXT_PLUGIN src/Plugins/ClearTextPassword/ClearTextPassword.cpp)
756 if(WITH_QTKEYCHAIN_PLUGIN)
757 trojita_add_plugin(trojita_plugin_QtKeychainPasswordPlugin WITH_QTKEYCHAIN_PLUGIN src/Plugins/QtKeyChain/QtKeyChainPassword.cpp)
759 qt5_use_modules(trojita_plugin_QtKeychainPasswordPlugin Core DBus)
761 target_link_libraries(trojita_plugin_QtKeychainPasswordPlugin ${QT_QTCORE_LIBRARY} ${QT_QTDBUS_LIBRARY})
763 target_link_libraries(trojita_plugin_QtKeychainPasswordPlugin ${QTKEYCHAIN_LIBRARIES})
764 if(SUPPORTS_TARGET_INCLUDES)
765 set_property(TARGET trojita_plugin_QtKeychainPasswordPlugin APPEND PROPERTY INCLUDE_DIRECTORIES ${QTKEYCHAIN_INCLUDE_DIRS})
767 include_directories(${QTKEYCHAIN_INCLUDE_DIRS})
771 ## AbookAddressbook plugin
772 if(WITH_ABOOKADDRESSBOOK_PLUGIN)
773 set(path_AbookAddressbook ${CMAKE_CURRENT_SOURCE_DIR}/src/Plugins/AbookAddressbook)
774 set(libAbookAddressbook_HEADERS
775 ${path_AbookAddressbook}/AbookAddressbook.h
776 ${path_AbookAddressbook}/be-contacts.h
778 set(libAbookAddressbook_SOURCES
779 ${path_AbookAddressbook}/AbookAddressbook.cpp
780 ${path_AbookAddressbook}/be-contacts.cpp
782 set(libAbookAddressbook_UI
783 ${path_AbookAddressbook}/be-contacts.ui
784 ${path_AbookAddressbook}/onecontact.ui
788 qt5_wrap_ui(libAbookAddressbook_UI_OUT ${libAbookAddressbook_UI})
790 qt4_wrap_ui(libAbookAddressbook_UI_OUT ${libAbookAddressbook_UI})
793 trojita_add_plugin(trojita_plugin_AbookAddressbookPlugin WITH_ABOOKADDRESSBOOK_PLUGIN ${libAbookAddressbook_SOURCES} ${libAbookAddressbook_UI_OUT})
794 set_property(TARGET trojita_plugin_AbookAddressbookPlugin APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
795 target_link_libraries(trojita_plugin_AbookAddressbookPlugin ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
798 qt5_use_modules(trojita_plugin_AbookAddressbookPlugin Widgets)
801 set(be_contacts_SOURCES
802 ${path_AbookAddressbook}/main.cpp
805 add_executable(be.contacts WIN32 ${be_contacts_SOURCES})
806 set_property(TARGET be.contacts APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
807 target_link_libraries(be.contacts Plugins ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
808 if("${WITH_ABOOKADDRESSBOOK_PLUGIN}" STREQUAL "STATIC")
809 set_property(TARGET be.contacts APPEND PROPERTY COMPILE_DEFINITIONS QT_STATICPLUGIN)
810 target_link_libraries(be.contacts trojita_plugin_AbookAddressbookPlugin)
813 qt5_use_modules(be.contacts Widgets)
821 ${KDEPIMLIBS_INCLUDE_DIRS}
825 ## KResource addressbook plugin
826 if(WITH_KRESOURCE_PLUGIN)
827 trojita_add_plugin(trojita_plugin_kresourceaddressbook WITH_KRESOURCE_PLUGIN src/Plugins/KDE/KResourceAddressbook.cpp)
828 target_link_libraries(trojita_plugin_kresourceaddressbook ${QT_QTCORE_LIBRARY} ${QT_QTDBUS_LIBRARY} ${KDEPIMLIBS_KABC_LIBS})
831 ## Akonadi addressbook plugin
832 if(WITH_AKONADI_PLUGIN)
833 trojita_add_plugin(trojita_plugin_akonadiaddressbook WITH_AKONADI_PLUGIN src/Plugins/KDE/AkonadiAddressbook.cpp)
834 target_link_libraries(trojita_plugin_akonadiaddressbook ${QT_QTCORE_LIBRARY} ${QT_QTDBUS_LIBRARY} ${KDEPIMLIBS_AKONADI_CONTACT_LIBS})
837 # Generate file static_plugins.h.in
838 get_property(STATIC_PLUGINS GLOBAL PROPERTY TROJITA_STATIC_PLUGINS)
839 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/static_plugins.h.in "#include <QtPlugin>\n")
840 foreach(PLUGIN ${STATIC_PLUGINS})
841 file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/static_plugins.h.in "Q_IMPORT_PLUGIN(${PLUGIN})\n")
843 execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/static_plugins.h.in ${CMAKE_CURRENT_BINARY_DIR}/static_plugins.h)
847 qt5_wrap_ui(libDesktopGui_UI_OUT ${libDesktopGui_UI})
848 qt5_add_resources(libDesktopGui_RESOURCES_OUT ${libDesktopGui_RESOURCES})
850 qt4_wrap_ui(libDesktopGui_UI_OUT ${libDesktopGui_UI})
851 qt4_add_resources(libDesktopGui_RESOURCES_OUT ${libDesktopGui_RESOURCES})
854 add_library(DesktopGui STATIC ${libDesktopGui_SOURCES} ${libDesktopGui_UI_OUT} ${libDesktopGui_RESOURCES_OUT})
855 set_property(TARGET DesktopGui APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
856 # The following is needed for the LineEdit widget within the .ui files.
857 # The ${path_DesktopGui} is needed so that the generated ui_*.h file can find the headers of the custom widgets
858 if(SUPPORTS_TARGET_INCLUDES)
859 set_property(TARGET DesktopGui APPEND PROPERTY INCLUDE_DIRECTORIES ${path_DesktopGui})
861 target_link_libraries(DesktopGui Common UiUtils Composer Imap IPC MSA Plugins Streams qwwsmtpclient ${QT_QTWEBKIT_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
863 # On Windows build a real Win32 GUI application without console window
864 # On other platforms WIN32 flag is ignored
865 add_executable(trojita WIN32 ${trojita_desktop_SOURCES} ${trojita_QM})
866 set_property(TARGET trojita APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
867 target_link_libraries(trojita AppVersion Common UiUtils DesktopGui ${STATIC_PLUGINS} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
869 target_link_libraries(trojita MimetypesQt4)
872 target_link_libraries(trojita ${ZLIB_LIBRARIES})
877 qt5_use_modules(AppVersion Core)
878 qt5_use_modules(Common Core Network)
879 qt5_use_modules(UiUtils Core Gui Network)
880 qt5_use_modules(Streams Network)
881 qt5_use_modules(qwwsmtpclient Network)
882 qt5_use_modules(MSA Network)
883 qt5_use_modules(Composer Gui Network)
884 qt5_use_modules(Imap Gui Network Sql)
886 qt5_use_modules(DesktopGui Network WebKitWidgets)
887 qt5_use_modules(trojita Widgets Network)
892 if(WITH_SHARED_PLUGINS)
893 install(TARGETS Plugins DESTINATION ${CMAKE_INSTALL_LIBDIR})
896 include(SanitizedDesktopFile)
898 if(WITH_ABOOKADDRESSBOOK_PLUGIN)
899 install(TARGETS be.contacts RUNTIME DESTINATION bin)
903 copy_desktop_file_without_cruft("${CMAKE_CURRENT_SOURCE_DIR}/src/Gui/trojita.desktop" "${CMAKE_CURRENT_BINARY_DIR}/trojita-DesktopGui.desktop")
904 install(TARGETS trojita RUNTIME DESTINATION bin)
905 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/trojita-DesktopGui.desktop DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications/" RENAME trojita.desktop)
906 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/Gui/trojita.appdata.xml DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/appdata/")
907 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/icons/trojita.png DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps/")
908 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/icons/trojita.svg DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps/")
917 set(test_LibMailboxSync_SOURCES
918 tests/Utils/ModelEvents.cpp
919 tests/Utils/LibMailboxSync.cpp
921 add_library(test_LibMailboxSync STATIC ${test_LibMailboxSync_SOURCES})
923 qt5_use_modules(test_LibMailboxSync Test Network)
925 if(SUPPORTS_TARGET_INCLUDES)
926 set_property(TARGET test_LibMailboxSync APPEND PROPERTY INCLUDE_DIRECTORIES
927 ${CMAKE_CURRENT_SOURCE_DIR}/tests
928 ${CMAKE_CURRENT_SOURCE_DIR}/tests/Utils)
930 target_link_libraries(test_LibMailboxSync Imap MSA Streams Common Composer ${QT_QTTEST_LIBRARY} ${QT_QTCORE_LIBRARY})
932 macro(trojita_test dir fname)
933 set(test_${fname}_SOURCES tests/${dir}/test_${fname}.cpp)
934 add_executable(test_${fname} ${test_${fname}_SOURCES})
935 target_link_libraries(test_${fname} Imap MSA Streams Common Composer test_LibMailboxSync)
937 qt5_use_modules(test_${fname} Network Sql Test Widgets)
939 target_link_libraries(test_${fname} ${QT_QTSQL_LIBRARY} ${QT_QTTEST_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY})
942 target_link_libraries(test_${fname} ${ZLIB_LIBRARIES})
944 if(SUPPORTS_TARGET_INCLUDES)
945 set_property(TARGET test_${fname} APPEND PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/tests)
947 if(NOT CMAKE_CROSSCOMPILING)
948 add_test(test_${fname} test_${fname})
953 trojita_test(Composer Composer_Submission)
954 trojita_test(Composer Composer_responses)
955 trojita_test(Composer Html_formatting)
957 qt5_use_modules(test_Composer_responses WebKitWidgets)
958 qt5_use_modules(test_Html_formatting WebKitWidgets)
960 target_link_libraries(test_Html_formatting ${QT_QTWEBKIT_LIBRARY})
962 trojita_test(Imap Imap_DisappearingMailboxes)
963 trojita_test(Imap Imap_Idle)
964 trojita_test(Imap Imap_LowLevelParser)
965 trojita_test(Imap Imap_Message)
966 trojita_test(Imap Imap_Model)
967 trojita_test(Imap Imap_MsgPartNetAccessManager)
968 trojita_test(Imap Imap_Parser_parse)
969 trojita_test(Imap Imap_Responses)
970 trojita_test(Imap Imap_SelectedMailboxUpdates)
971 trojita_test(Imap Imap_Tasks_CreateMailbox)
972 trojita_test(Imap Imap_Tasks_DeleteMailbox)
973 trojita_test(Imap Imap_Tasks_ListChildMailboxes)
974 trojita_test(Imap Imap_Tasks_ObtainSynchronizedMailbox)
975 trojita_test(Imap Imap_Tasks_OpenConnection)
976 trojita_test(Imap Imap_Threading)
977 trojita_test(Imap Imap_BodyParts)
978 trojita_test(Imap Imap_Offline)
979 trojita_test(Imap Imap_CopyAndFlagOperations)
980 trojita_test(Misc Rfc5322)
981 trojita_test(Misc RingBuffer)
982 trojita_test(Misc SenderIdentitiesModel)
983 trojita_test(Misc SqlCache)
984 trojita_test(Misc algorithms)
985 trojita_test(Misc rfccodecs)
989 if(WIN32) # Check if we are on Windows
990 if(MSVC10) # Check if we are using the Visual Studio compiler 2010
991 # Because of linker errors (see http://stackoverflow.com/questions/5625884/conversion-of-stdwstring-to-qstring-throws-linker-error)
992 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:wchar_t-")
995 message(WARNING "You are using a compiler which we have not tested yet (not MSVC10 or MINGW).")
996 message(WARNING "Please let us know how well it works.")