2 # The Qt5's qt5_use_modules is only available on 2.8.9 or later -- sweet, isn't it?
3 cmake_minimum_required(VERSION 2.8.9)
5 cmake_minimum_required(VERSION 2.8.7)
8 # Set a default build type if none was specified. This was shamelessly stolen
9 # from VTK's cmake setup because these guys produce both CMake and a project that
10 # manipulates this variable, and the web is full of posts where people say that
11 # it is apparently evil to just set the build type in a way an earlier version of
12 # this patch did. Oh, and the location of this check/update matters, apparently.
14 # Yes, this is just plain crazy.
15 if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
16 message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
17 set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
18 # Set the possible values of build type for cmake-gui
19 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
23 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
25 # POSITION_INDEPENDENT_CODE is only available on cmake 2.8.9 or later
26 # Add needed flags for supported compilers which simulate POSITION_INDEPENDENT_CODE property
27 if(CMAKE_VERSION VERSION_LESS "2.8.9")
28 if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
29 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
31 message(FATAL_ERROR "Needs GNU or Clang C++ compiler or CMake 2.8.9 (or later)")
34 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
37 include(FindCXXFeatures)
38 if(NOT CXXFeatures_auto_FOUND)
39 message(SEND_ERROR "Your compiler doesn't support C++11's auto")
41 if(NOT CXXFeatures_static_assert_FOUND)
42 message(SEND_ERROR "Your compiler doesn't support C++11's static_assert")
44 if(NOT CXXFeatures_alignof_FOUND)
45 if(NOT CMAKE_COMPILER_IS_GNUCXX AND NOT MSVC)
46 message(SEND_ERROR "Your compiler doesn't support C++11's alignof and it also isn't gcc or MSVC. Either would work.")
49 if(NOT CXXFeatures_nullptr_FOUND)
50 # Yes, this is extremely fragile; it will break on any code which wants to
51 # distinguish between an int and nullptr_t. So far, we don't have anything
52 # like that in Trojita. Let's just pretend that it won't ever happen, and
53 # if it happens, then let's hope that an "ambiguous overload" would come up.
54 add_definitions(-Dnullptr=0)
55 message(WARNING "Your C++ compiler doesn't support C++11's nullptr. Activating a very hackish workaround "
56 "which can break existing code because nullptr is not plain 0.")
58 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_COMPILER_FLAGS}")
60 include(TrojitaOption)
62 trojita_option(WITH_DESKTOP "Build desktop version" ON)
63 trojita_option(WITH_HARMATTAN "Build MeeGo Harmattan version" OFF "NOT WITH_DESKTOP")
64 trojita_option(WITH_QT5 "Build with Qt5 library" OFF)
65 trojita_option(WITH_DBUS "Build with DBus library" AUTO)
66 trojita_option(WITH_RAGEL "Build with Ragel library" AUTO)
67 trojita_option(WITH_ZLIB "Build with zlib library" AUTO)
68 trojita_option(WITH_SHARED_PLUGINS "Enable shared dynamic plugins" ON)
69 trojita_option(WITH_TESTS "Build tests" ON "NOT WITH_HARMATTAN")
72 trojita_option(WITH_NSIS "Build Windows NSIS installer" AUTO "WITH_DESKTOP")
75 if(UNIX AND NOT APPLE)
76 set(QTKEYCHAIN_DEPENDS ";WITH_DBUS")
78 set(QTKEYCHAIN_DEPENDS "")
82 message(STATUS "Building the Qt5 version")
83 find_package(Qt5Core 5.2 REQUIRED)
84 find_package(Qt5Gui REQUIRED)
85 find_package(Qt5Network REQUIRED)
86 find_package(Qt5Sql REQUIRED)
87 find_package(Qt5WebKitWidgets REQUIRED)
88 find_package(Qt5Widgets REQUIRED)
89 find_package(Qt5LinguistTools)
90 trojita_find_package(Qt5DBus "" "http://qt-project.org" "Qt5 D-Bus support" "Needed for IPC anf for some plugins" WITH_DBUS)
91 trojita_find_package(Qt5Test "" "http://qt-project.org" "Qt5 QTest library" "Needed for automated tests" WITH_TESTS)
92 if(Qt5LinguistTools_FOUND)
93 find_package(Qt5LinguistForTrojita)
96 message(STATUS "Building the Qt4 version")
97 set(QT_USE_QTNETWORK 1)
99 set(QT_USE_QTWEBKIT 1)
107 set(QT_USE_QTDECLARATIVE 1)
109 trojita_find_package(Qt4 4.6 "http://qt-project.org" "Qt4" "Needed for building" REQUIRED)
110 include(${QT_USE_FILE})
111 trojita_check_qt4_module(QTCORE REQUIRED)
112 trojita_check_qt4_module(QTGUI REQUIRED)
113 trojita_check_qt4_module(QTNETWORK REQUIRED)
114 trojita_check_qt4_module(QTSQL REQUIRED)
115 trojita_check_qt4_module(QTWEBKIT REQUIRED)
116 trojita_check_qt4_module(QTDBUS WITH_DBUS)
117 trojita_check_qt4_module(QTTEST WITH_TESTS)
118 trojita_check_qt4_module(QTDECLARATIVE WITH_HARMATTAN)
119 trojita_find_package(LinguistForTrojita "" "" "" "")
120 if(NOT QT_QCONFIG MATCHES "openssl" OR QT_QCONFIG MATCHES "no-openssl")
121 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")
125 trojita_plugin_option(WITH_CLEARTEXT_PLUGIN "Build Cleartext password plugin" STATIC)
126 trojita_plugin_option(WITH_QTKEYCHAIN_PLUGIN "Build Qtkeychain password plugin" "NOT WITH_HARMATTAN${QTKEYCHAIN_DEPENDS}")
128 trojita_find_package(Git "" "" "" "")
131 trojita_find_package(MakeNSIS "" "http://nsis.sourceforge.net" "Nullsoft Scriptable Install System" "Needed for building Windows installer" WITH_NSIS)
134 # Add support for Mingw RC compiler
137 include(CMakeDetermineRCCompiler)
140 set(CMAKE_RC_COMPILER_INIT windres)
141 set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
146 trojita_find_package(Qt5Keychain "" "https://github.com/frankosterfeld/qtkeychain" "QtKeychain library (Qt5 version)" "Needed for QtKeychain password plugin" WITH_QTKEYCHAIN_PLUGIN)
148 trojita_find_package(QtKeychain "" "https://github.com/frankosterfeld/qtkeychain" "QtKeychain library" "Needed for QtKeychain password plugin" WITH_QTKEYCHAIN_PLUGIN)
150 if(Qt5Keychain_FOUND OR QtKeychain_FOUND)
151 message(STATUS "Found QtKeychain library (includes at ${QTKEYCHAIN_INCLUDE_DIRS}, lib at ${QTKEYCHAIN_LIBRARIES})")
154 if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
155 set(CMAKE_INSTALL_LIBDIR "lib${LIB_SUFFIX}")
157 mark_as_advanced(CMAKE_INSTALL_LIBDIR)
159 if(NOT CMAKE_INSTALL_PLUGIN_DIR)
160 set(CMAKE_INSTALL_PLUGIN_DIR "${CMAKE_INSTALL_LIBDIR}/trojita")
162 mark_as_advanced(CMAKE_INSTALL_PLUGIN_DIR)
165 if(IS_ABSOLUTE ${CMAKE_INSTALL_PLUGIN_DIR})
166 set(PLUGIN_DIR "${CMAKE_INSTALL_PLUGIN_DIR}")
168 set(PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_PLUGIN_DIR}")
171 mark_as_advanced(PLUGIN_DIR)
173 # When manipulating CXXFLAGS, we put the user's CXXFLAGS *after* that so that they take priority.
175 # See below for some reationale for these optimizations
176 set(CMAKE_CXX_FLAGS "/O2 ${CMAKE_CXX_FLAGS}")
178 # We have no information about the warnings and their usefullness. Reports are welcome.
179 # We might enable warnings on MSVC in future.
181 # -Werror is not a default for sanity reasons (one cannot know what warnings a future compiler
182 # might bring along), but it's a default in debug mode. The idea is that developers should care
183 # about a warning-free build, and that this is easier than messing with yet another configure option.
184 set(CMAKE_CXX_FLAGS_DEBUG "-Werror ${CMAKE_CXX_FLAGS_DEBUG}")
186 # Optimizations are enabled unconditionally because they make a big difference in the speed of the
187 # resulting binaries, and that it is better to allow an opt-out from them by adjusting CXXFLAGS through
188 # an env var at cmake time if needed.
189 # The reason for not manipulating just CMAKE_CXX_FLAGS_DEBUG is that unrecognized build types ("DebugFull")
190 # should still benefit from these optimizations. Yup, it would be even better if CMake did a sane thing
191 # and warned when users set an unrecognized and unused build type, but that just isn't the case.
192 set(CMAKE_CXX_FLAGS "-O2 ${CMAKE_CXX_FLAGS}")
194 # Build warnings are useful tools (and Trojita should be warning-free anyway), enable them on all
195 # configurations. They are warnings, not errors.
196 set(CMAKE_CXX_FLAGS "-Wall -Wsign-compare ${CMAKE_CXX_FLAGS}")
199 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
200 # The following is required so that the moc_*.cpp and ui_*.h are found
201 include_directories(${CMAKE_CURRENT_BINARY_DIR})
202 add_definitions(-DQT_STRICT_ITERATORS)
204 # Make sure that plugins not export all symbols, only that which are explicitly marked
205 include(GenerateExportHeader)
206 add_compiler_export_flags()
208 if(NOT WITH_QT5 AND CMAKE_VERSION VERSION_LESS 2.8.10)
209 set(SUPPORTS_TARGET_INCLUDES 0)
211 ${QT_MKSPECS_DIR}/default
212 ${CMAKE_CURRENT_SOURCE_DIR}/src/Gui/
213 ${CMAKE_CURRENT_SOURCE_DIR}/src/mimetypes-qt4/io/
214 ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan/qmlapplicationviewer
215 ${CMAKE_CURRENT_SOURCE_DIR}/tests
216 ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_LibMailboxSync)
218 set(SUPPORTS_TARGET_INCLUDES 1)
221 set(CMAKE_AUTOMOC True)
223 trojita_find_package(RagelForTrojita "" "" "" "" WITH_RAGEL)
225 if(WIN32) # Check if we are on Windows
226 # On win32, qt can statically link to zlib and export their symbols.
227 # We check if we can find the string " zlib " in the QT_CONFIG list in
228 # ${QT_MKSPECS_DIR}/qconfig.pri and include on success ${QT_QTCORE_LIBRARY}
229 # and ${QTDIR}/src/3rdparty/zlib as lib and include folder
231 message(STATUS "We are on Windows with Qt. Checking if zlib is built into Qt")
233 if(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
234 file(READ ${QT_MKSPECS_DIR}/qconfig.pri _qconfig_FILE_contents_ZLIB_CHECK)
235 string(REGEX MATCH "QT_CONFIG[^\n]+" QT_CONFIG_ZLIB_CHECK ${_qconfig_FILE_contents_ZLIB_CHECK})
237 set(ENV_QTDIR $ENV{QTDIR})
238 if(NOT DEFINED ENV_QTDIR)
239 message(STATUS "QTDIR not specified in environment, will not use zlib")
240 elseif(QT_CONFIG_ZLIB_CHECK)
241 if(QT_CONFIG_ZLIB_CHECK MATCHES " zlib ")
242 message(STATUS "Found zlib in QT_QCONFIG. zlib seems to be built into Qt")
243 set(ZLIB_LIBRARY_RELEASE ${QT_QTCORE_LIBRARY_RELEASE})
244 set(ZLIB_LIBRARY_DEBUG ${QT_QTCORE_LIBRARY_DEBUG})
245 set(ZLIB_LIBRARY ${QT_QTCORE_LIBRARY})
247 string(REGEX REPLACE "\\\\" "/" QTDIR ${ENV_QTDIR})
248 set(ZLIB_INCLUDE_DIR "${QTDIR}/src/3rdparty/zlib")
251 set(ZLIB_LIBRARIES ${ZLIB_LIBRARY} )
252 mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR ZLIB_FOUND)
253 else(QT_CONFIG_ZLIB_CHECK MATCHES " zlib ")
254 message(STATUS "Could not determine if Qt was built with zlib support.")
255 endif(QT_CONFIG_ZLIB_CHECK MATCHES " zlib ")
258 endif(EXISTS "${QT_MKSPECS_DIR}/qconfig.pri")
259 endif(QT_QTCORE_FOUND)
263 trojita_find_package(ZLIB "" "" "" "" WITH_ZLIB)
267 set(TROJITA_HAVE_ZLIB True)
268 message(STATUS "Support for COMPRESS=DEFLATE enabled")
270 set(TROJITA_HAVE_ZLIB False)
271 message(STATUS "Disabling COMPRESS=DEFLATE, zlib is not available")
274 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/configure.cmake.in
275 ${CMAKE_CURRENT_BINARY_DIR}/configure.cmake.h)
277 feature_summary(FATAL_ON_MISSING_REQUIRED_PACKAGES DESCRIPTION "\n" WHAT ALL)
279 set(path_Common ${CMAKE_CURRENT_SOURCE_DIR}/src/Common)
280 set(libCommon_SOURCES
281 ${path_Common}/Application.cpp
282 ${path_Common}/ConnectionId.cpp
283 ${path_Common}/DeleteAfter.cpp
284 ${path_Common}/FileLogger.cpp
285 ${path_Common}/MetaTypes.cpp
286 ${path_Common}/Paths.cpp
287 ${path_Common}/SettingsNames.cpp
290 set(path_Plugins ${CMAKE_CURRENT_SOURCE_DIR}/src/Plugins)
291 set(libPlugins_SOURCES
292 ${path_Plugins}/AddressbookPlugin.cpp
293 ${path_Plugins}/PasswordPlugin.cpp
294 ${path_Plugins}/PluginJob.cpp
295 ${path_Plugins}/PluginManager.cpp
298 set(path_UiUtils ${CMAKE_CURRENT_SOURCE_DIR}/src/UiUtils)
299 set(libUiUtils_SOURCES
300 ${path_UiUtils}/Color.cpp
301 ${path_UiUtils}/Formatting.cpp
302 ${path_UiUtils}/PasswordWatcher.cpp
303 ${path_UiUtils}/PlainTextFormatter.cpp
306 set(path_IPC ${CMAKE_CURRENT_SOURCE_DIR}/src/IPC)
310 ${path_IPC}/DBusInterface.cpp
311 ${path_IPC}/MainWindowBridge.cpp
319 set(path_Composer ${CMAKE_CURRENT_SOURCE_DIR}/src/Composer)
320 set(libComposer_SOURCES
321 ${path_Composer}/ComposerAttachments.cpp
322 ${path_Composer}/Mailto.cpp
323 ${path_Composer}/MessageComposer.cpp
324 ${path_Composer}/QuoteText.cpp
325 ${path_Composer}/Recipients.cpp
326 ${path_Composer}/ReplaceSignature.cpp
327 ${path_Composer}/SenderIdentitiesModel.cpp
328 ${path_Composer}/SubjectMangling.cpp
329 ${path_Composer}/Submission.cpp
332 set(path_MSA ${CMAKE_CURRENT_SOURCE_DIR}/src/MSA)
334 ${path_MSA}/AbstractMSA.cpp
335 ${path_MSA}/Account.cpp
336 ${path_MSA}/FakeMSA.cpp
337 ${path_MSA}/ImapSubmit.cpp
339 ${path_MSA}/Sendmail.cpp
342 set(path_Streams ${CMAKE_CURRENT_SOURCE_DIR}/src/Streams)
343 set(libStreams_SOURCES
344 ${path_Streams}/DeletionWatcher.cpp
345 ${path_Streams}/FakeSocket.cpp
346 ${path_Streams}/IODeviceSocket.cpp
347 ${path_Streams}/Socket.cpp
348 ${path_Streams}/SocketFactory.cpp
352 set(libStreams_SOURCES ${libStreams_SOURCES}
353 ${path_Streams}/3rdparty/rfc1951.cpp)
354 include_directories(${ZLIB_INCLUDE_DIR})
358 set(path_mimetypesqt4 ${CMAKE_CURRENT_SOURCE_DIR}/src/mimetypes-qt4)
359 set(libMimetypesQt4_SOURCES
360 ${path_mimetypesqt4}/io/qstandardpaths.cpp
361 ${path_mimetypesqt4}/mimetypes/qmimedatabase.cpp
362 ${path_mimetypesqt4}/mimetypes/qmimeglobpattern.cpp
363 ${path_mimetypesqt4}/mimetypes/qmimemagicrule.cpp
364 ${path_mimetypesqt4}/mimetypes/qmimemagicrulematcher.cpp
365 ${path_mimetypesqt4}/mimetypes/qmimetype.cpp
366 ${path_mimetypesqt4}/mimetypes/qmimetypeparser.cpp
367 ${path_mimetypesqt4}/mimetypes/qmimeprovider.cpp
370 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
371 ${path_mimetypesqt4}/io/qstandardpaths_win.cpp)
373 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
374 ${path_mimetypesqt4}/io/qstandardpaths_mac.cpp)
376 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
377 ${path_mimetypesqt4}/io/qstandardpaths_os2.cpp)
379 set(libMimetypesQt4_SOURCES ${libMimetypesQt4_SOURCES}
380 ${path_mimetypesqt4}/io/qstandardpaths_unix.cpp)
382 message(FATAL_ERROR "Unsupported platform -- mimetypes-Qt4 support only Unix, MacOSX, Windows and OS/2")
386 set(path_DesktopGui ${CMAKE_CURRENT_SOURCE_DIR}/src/Gui)
387 set(libDesktopGui_SOURCES
388 ${path_DesktopGui}/AttachmentView.cpp
389 ${path_DesktopGui}/AutoCompletion.cpp
390 ${path_DesktopGui}/CompleteMessageWidget.cpp
391 ${path_DesktopGui}/ComposeWidget.cpp
392 ${path_DesktopGui}/ComposerAttachmentsList.cpp
393 ${path_DesktopGui}/ComposerTextEdit.cpp
394 ${path_DesktopGui}/EmbeddedWebView.cpp
395 ${path_DesktopGui}/EnvelopeView.cpp
396 ${path_DesktopGui}/ExternalElementsWidget.cpp
397 ${path_DesktopGui}/FindBar.cpp
398 ${path_DesktopGui}/FlowLayout.cpp
399 ${path_DesktopGui}/FromAddressProxyModel.cpp
400 ${path_DesktopGui}/LineEdit.cpp
401 ${path_DesktopGui}/LoadablePartWidget.cpp
402 ${path_DesktopGui}/MailBoxTreeView.cpp
403 ${path_DesktopGui}/MessageListWidget.cpp
404 ${path_DesktopGui}/MessageSourceWidget.cpp
405 ${path_DesktopGui}/MessageView.cpp
406 ${path_DesktopGui}/MsgListView.cpp
407 ${path_DesktopGui}/OnePanelAtTimeWidget.cpp
408 ${path_DesktopGui}/OverlayWidget.cpp
409 ${path_DesktopGui}/PartWalker.cpp
410 ${path_DesktopGui}/PartWidget.cpp
411 ${path_DesktopGui}/PartWidgetFactoryVisitor.cpp
412 ${path_DesktopGui}/PasswordDialog.cpp
413 ${path_DesktopGui}/ProgressPopUp.cpp
414 ${path_DesktopGui}/ProtocolLoggerWidget.cpp
415 ${path_DesktopGui}/ReplaceCharValidator.cpp
416 ${path_DesktopGui}/SettingsDialog.cpp
417 ${path_DesktopGui}/SimplePartWidget.cpp
418 ${path_DesktopGui}/Spinner.cpp
419 ${path_DesktopGui}/TagListWidget.cpp
420 ${path_DesktopGui}/TagWidget.cpp
421 ${path_DesktopGui}/TaskProgressIndicator.cpp
422 ${path_DesktopGui}/UserAgentWebPage.cpp
423 ${path_DesktopGui}/Util.cpp
424 ${path_DesktopGui}/Window.cpp
425 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigDialog.cpp
426 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigWidget.cpp
427 ${path_DesktopGui}/ShortcutHandler/ShortcutHandler.cpp
430 ${path_DesktopGui}/AboutDialog.ui
431 ${path_DesktopGui}/ComposeWidget.ui
432 ${path_DesktopGui}/CreateMailboxDialog.ui
433 ${path_DesktopGui}/EditIdentity.ui
434 ${path_DesktopGui}/PasswordDialog.ui
435 ${path_DesktopGui}/ProgressPopUp.ui
436 ${path_DesktopGui}/SettingsCachePage.ui
437 ${path_DesktopGui}/SettingsGeneralPage.ui
438 ${path_DesktopGui}/SettingsImapPage.ui
439 ${path_DesktopGui}/SettingsOutgoingPage.ui
440 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigWidget.ui
442 set(libDesktopGui_RESOURCES
443 ${CMAKE_CURRENT_SOURCE_DIR}/src/icons.qrc
444 ${CMAKE_CURRENT_SOURCE_DIR}/src/license.qrc
447 set(libqwwsmtpclient_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/qwwsmtpclient/qwwsmtpclient.cpp)
449 set(libAppVersion_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/AppVersion/SetCoreApplication.cpp)
451 set(path_Imap ${CMAKE_CURRENT_SOURCE_DIR}/src/Imap)
453 ${path_Imap}/ConnectionState.cpp
454 ${path_Imap}/Encoders.cpp
455 ${path_Imap}/Exceptions.cpp
456 ${path_Imap}/Parser/3rdparty/kcodecs.cpp
457 ${path_Imap}/Parser/3rdparty/rfccodecs.cpp
459 ${path_Imap}/Parser/Command.cpp
460 ${path_Imap}/Parser/Data.cpp
461 ${path_Imap}/Parser/LowLevelParser.cpp
462 ${path_Imap}/Parser/MailAddress.cpp
463 ${path_Imap}/Parser/Message.cpp
464 ${path_Imap}/Parser/Parser.cpp
465 ${path_Imap}/Parser/Response.cpp
466 ${path_Imap}/Parser/Sequence.cpp
467 ${path_Imap}/Parser/ThreadingNode.cpp
469 ${path_Imap}/Network/FileDownloadManager.cpp
470 ${path_Imap}/Network/ForbiddenReply.cpp
471 ${path_Imap}/Network/MsgPartNetAccessManager.cpp
472 ${path_Imap}/Network/MsgPartNetworkReply.cpp
473 ${path_Imap}/Network/QQuickNetworkReplyWrapper.cpp
475 ${path_Imap}/Model/Cache.cpp
476 ${path_Imap}/Model/CombinedCache.cpp
477 ${path_Imap}/Model/DragAndDrop.cpp
478 ${path_Imap}/Model/DiskPartCache.cpp
479 ${path_Imap}/Model/DummyNetworkWatcher.cpp
480 ${path_Imap}/Model/FindInterestingPart.cpp
481 ${path_Imap}/Model/FlagsOperation.cpp
482 ${path_Imap}/Model/FullMessageCombiner.cpp
483 ${path_Imap}/Model/ImapAccess.cpp
484 ${path_Imap}/Model/MailboxFinder.cpp
485 ${path_Imap}/Model/MailboxMetadata.cpp
486 ${path_Imap}/Model/MailboxModel.cpp
487 ${path_Imap}/Model/MailboxTree.cpp
488 ${path_Imap}/Model/MemoryCache.cpp
489 ${path_Imap}/Model/Model.cpp
490 ${path_Imap}/Model/MsgListModel.cpp
491 ${path_Imap}/Model/NetworkWatcher.cpp
492 ${path_Imap}/Model/OneMessageModel.cpp
493 ${path_Imap}/Model/ParserState.cpp
494 ${path_Imap}/Model/PrettyMailboxModel.cpp
495 ${path_Imap}/Model/PrettyMsgListModel.cpp
496 ${path_Imap}/Model/SpecialFlagNames.cpp
497 ${path_Imap}/Model/SQLCache.cpp
498 ${path_Imap}/Model/SubtreeModel.cpp
499 ${path_Imap}/Model/SystemNetworkWatcher.cpp
500 ${path_Imap}/Model/TaskFactory.cpp
501 ${path_Imap}/Model/TaskPresentationModel.cpp
502 ${path_Imap}/Model/ThreadingMsgListModel.cpp
503 ${path_Imap}/Model/Utils.cpp
504 ${path_Imap}/Model/VisibleTasksModel.cpp
506 # The ModelTest is only needed when debugging manually
507 #${path_Imap}/Model/ModelTest/modeltest.cpp
508 # The ModelWatcher is another debugging aid
509 ${path_Imap}/Model/ModelWatcher.cpp
511 ${path_Imap}/Model/kdeui-itemviews/kdescendantsproxymodel.cpp
513 ${path_Imap}/Tasks/AppendTask.cpp
514 ${path_Imap}/Tasks/CopyMoveMessagesTask.cpp
515 ${path_Imap}/Tasks/CreateMailboxTask.cpp
516 ${path_Imap}/Tasks/DeleteMailboxTask.cpp
517 ${path_Imap}/Tasks/EnableTask.cpp
518 ${path_Imap}/Tasks/ExpungeMailboxTask.cpp
519 ${path_Imap}/Tasks/ExpungeMessagesTask.cpp
520 ${path_Imap}/Tasks/Fake_ListChildMailboxesTask.cpp
521 ${path_Imap}/Tasks/Fake_OpenConnectionTask.cpp
522 ${path_Imap}/Tasks/FetchMsgMetadataTask.cpp
523 ${path_Imap}/Tasks/FetchMsgPartTask.cpp
524 ${path_Imap}/Tasks/GenUrlAuthTask.cpp
525 ${path_Imap}/Tasks/GetAnyConnectionTask.cpp
526 ${path_Imap}/Tasks/IdTask.cpp
527 ${path_Imap}/Tasks/IdleLauncher.cpp
528 ${path_Imap}/Tasks/ImapTask.cpp
529 ${path_Imap}/Tasks/KeepMailboxOpenTask.cpp
530 ${path_Imap}/Tasks/ListChildMailboxesTask.cpp
531 ${path_Imap}/Tasks/NoopTask.cpp
532 ${path_Imap}/Tasks/NumberOfMessagesTask.cpp
533 ${path_Imap}/Tasks/ObtainSynchronizedMailboxTask.cpp
534 ${path_Imap}/Tasks/OfflineConnectionTask.cpp
535 ${path_Imap}/Tasks/OpenConnectionTask.cpp
536 ${path_Imap}/Tasks/SortTask.cpp
537 ${path_Imap}/Tasks/SubscribeUnsubscribeTask.cpp
538 ${path_Imap}/Tasks/ThreadTask.cpp
539 ${path_Imap}/Tasks/UidSubmitTask.cpp
540 ${path_Imap}/Tasks/UnSelectTask.cpp
541 ${path_Imap}/Tasks/UpdateFlagsTask.cpp
542 ${path_Imap}/Tasks/UpdateFlagsOfAllMessagesTask.cpp
546 message(STATUS "Using Ragel for the RFC 5322 parser")
547 ragel_parser(${path_Imap}/Parser/Rfc5322HeaderParser.cpp)
548 set(libImap_SOURCES ${libImap_SOURCES}
549 ${CMAKE_CURRENT_BINARY_DIR}/Rfc5322HeaderParser.generated.cpp)
551 message(STATUS "Using pregenerated RFC 5322 parser")
552 set(libImap_SOURCES ${libImap_SOURCES}
553 ${path_Imap}/Parser/Rfc5322HeaderParser.generated.cpp)
556 set(path_AbookAddressbook ${CMAKE_CURRENT_SOURCE_DIR}/src/AbookAddressbook)
557 set(libAbookAddressbook_SOURCES
558 ${path_AbookAddressbook}/AbookAddressbook.cpp
559 ${path_AbookAddressbook}/be-contacts.cpp
561 set(libAbookAddressbook_UI
562 ${path_AbookAddressbook}/be-contacts.ui
563 ${path_AbookAddressbook}/onecontact.ui
566 set(trojita_desktop_SOURCES
567 ${path_DesktopGui}/main.cpp
571 list(APPEND trojita_desktop_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/trojita_win32.rc)
574 set(be_contacts_SOURCES
575 ${CMAKE_CURRENT_SOURCE_DIR}/src/be.contacts/main.cpp
578 set(libQNAMWebView_SOURCES
579 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/plugin.cpp
580 ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/qdeclarativewebview.cpp
583 set(trojitaHarmattan_SOURCES
584 ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan/main.cpp
585 ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan/qmlapplicationviewer/qmlapplicationviewer.cpp
588 if(LinguistForTrojita_FOUND OR Qt5LinguistForTrojita_FOUND)
589 file(GLOB_RECURSE lang_PO "${CMAKE_CURRENT_SOURCE_DIR}/po/trojita_common_*.po")
591 qt5_wrap_po(trojita_QM ${lang_PO})
593 qt4_wrap_po(trojita_QM ${lang_PO})
595 set(language_summary "")
596 foreach(po ${lang_PO})
597 string(REGEX REPLACE "^(.*)/trojita_common_(.*).po" "\\2" lang ${po})
598 list(APPEND language_summary ${lang})
600 list(SORT language_summary)
601 list(LENGTH language_summary num_languages)
603 message(STATUS "Available languages: ${language_summary}")
605 install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/locale/ DESTINATION share/trojita/locale REGEX "(x_test)|(.*\\.ts)" EXCLUDE)
608 message(STATUS "No .po files found, will not install any languages")
611 message(STATUS "Qt Linguist (lupdate/lrelease/lconvert) not found, disabling localization support")
614 set(version_files ${CMAKE_CURRENT_BINARY_DIR}/trojita-version.h ${CMAKE_CURRENT_BINARY_DIR}/trojita-git-version.h)
616 set(version_files ${version_files} ${CMAKE_CURRENT_BINARY_DIR}/trojita-version.nsi)
620 add_custom_target(version DEPENDS version_fake_file)
621 add_custom_command(OUTPUT version_fake_file ${version_files}
622 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)
623 set_source_files_properties(${version_files}
624 PROPERTIES GENERATED TRUE
625 HEADER_FILE_ONLY TRUE)
627 add_library(Common STATIC ${libCommon_SOURCES})
628 set_property(TARGET Common APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
629 add_dependencies(Common version)
630 target_link_libraries(Common ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
632 add_library(AppVersion STATIC ${libAppVersion_SOURCES})
633 set_property(TARGET AppVersion APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
634 add_dependencies(AppVersion version)
635 target_link_libraries(AppVersion Common ${QT_QTCORE_LIBRARY})
637 if(WITH_SHARED_PLUGINS)
638 add_library(Plugins SHARED ${libPlugins_SOURCES})
640 add_library(Plugins STATIC ${libPlugins_SOURCES})
641 set_property(TARGET Plugins APPEND PROPERTY COMPILE_DEFINITIONS QT_STATICPLUGIN)
643 set_target_properties(Plugins PROPERTIES OUTPUT_NAME trojita_plugins)
644 set_property(TARGET Plugins APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
646 qt5_use_modules(Plugins Core)
648 target_link_libraries(Plugins ${QT_QTCORE_LIBRARY})
651 add_library(UiUtils STATIC ${libUiUtils_SOURCES})
652 set_property(TARGET UiUtils APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
653 target_link_libraries(UiUtils Plugins Common ${QT_QTCORE_LIBRARY})
655 add_library(Streams STATIC ${libStreams_SOURCES})
656 set_property(TARGET Streams APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
657 target_link_libraries(Streams ${QT_QTNETWORK_LIBRARY} ${QT_QTCORE_LIBRARY})
659 target_link_libraries(Streams ${ZLIB_LIBRARIES})
662 add_library(IPC STATIC ${libIPC_SOURCES})
663 set_property(TARGET IPC APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
665 target_link_libraries(IPC ${QT_QTDBUS_LIBRARY})
667 qt5_use_modules(IPC DBus Widgets)
671 qt5_use_modules(IPC Core)
675 add_library(qwwsmtpclient STATIC ${libqwwsmtpclient_SOURCES})
676 target_link_libraries(qwwsmtpclient ${QT_QTNETWORK_LIBRARY} ${QT_QTCORE_LIBRARY})
678 add_library(MSA STATIC ${libMSA_SOURCES})
679 set_property(TARGET MSA APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
680 target_link_libraries(MSA Imap Streams qwwsmtpclient ${QT_QTCORE_LIBRARY})
682 add_library(Composer STATIC ${libComposer_SOURCES})
683 set_property(TARGET Composer APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
684 target_link_libraries(Composer Common MSA Streams UiUtils qwwsmtpclient ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
686 target_link_libraries(Composer MimetypesQt4)
689 add_library(Imap STATIC ${libImap_SOURCES})
690 set_property(TARGET Imap APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
691 target_link_libraries(Imap Common Streams UiUtils ${QT_QTNETWORK_LIBRARY} ${QT_QTSQL_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
693 target_link_libraries(Imap ${ZLIB_LIBRARIES})
697 add_library(MimetypesQt4 STATIC ${libMimetypesQt4_SOURCES})
698 if(SUPPORTS_TARGET_INCLUDES)
699 set_property(TARGET MimetypesQt4 APPEND PROPERTY INCLUDE_DIRECTORIES
700 ${QT_MKSPECS_DIR}/default ${path_mimetypesqt4}/io/)
702 target_link_libraries(MimetypesQt4 ${QT_QTCORE_LIBRARY})
704 find_library(CARBON_LIBRARY Carbon REQUIRED)
705 target_link_libraries(MimetypesQt4 ${CARBON_LIBRARY})
709 ## ClearText password plugin
710 if(WITH_CLEARTEXT_PLUGIN)
711 trojita_add_plugin(trojita_plugin_ClearTextPasswordPlugin WITH_CLEARTEXT_PLUGIN src/Plugins/ClearTextPassword/ClearTextPassword.cpp)
715 if(WITH_QTKEYCHAIN_PLUGIN)
716 trojita_add_plugin(trojita_plugin_QtKeychainPasswordPlugin WITH_QTKEYCHAIN_PLUGIN src/Plugins/QtKeyChain/QtKeyChainPassword.cpp)
718 qt5_use_modules(trojita_plugin_QtKeychainPasswordPlugin Core DBus)
720 target_link_libraries(trojita_plugin_QtKeychainPasswordPlugin ${QT_QTCORE_LIBRARY} ${QT_QTDBUS_LIBRARY})
722 target_link_libraries(trojita_plugin_QtKeychainPasswordPlugin ${QTKEYCHAIN_LIBRARIES})
723 if(SUPPORTS_TARGET_INCLUDES)
724 set_property(TARGET trojita_plugin_QtKeychainPasswordPlugin APPEND PROPERTY INCLUDE_DIRECTORIES ${QTKEYCHAIN_INCLUDE_DIRS})
726 include_directories(${QTKEYCHAIN_INCLUDE_DIRS})
730 # Generate file static_plugins.h.in
731 get_property(STATIC_PLUGINS GLOBAL PROPERTY TROJITA_STATIC_PLUGINS)
732 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/static_plugins.h.in "#include <QtPlugin>\n")
733 foreach(PLUGIN ${STATIC_PLUGINS})
734 file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/static_plugins.h.in "Q_IMPORT_PLUGIN(${PLUGIN})\n")
736 execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/static_plugins.h.in ${CMAKE_CURRENT_BINARY_DIR}/static_plugins.h)
740 qt5_wrap_ui(libAbookAddressbook_UI_OUT ${libAbookAddressbook_UI})
741 qt5_wrap_ui(libDesktopGui_UI_OUT ${libDesktopGui_UI})
742 qt5_add_resources(libDesktopGui_RESOURCES_OUT ${libDesktopGui_RESOURCES})
744 qt4_wrap_ui(libAbookAddressbook_UI_OUT ${libAbookAddressbook_UI})
745 qt4_wrap_ui(libDesktopGui_UI_OUT ${libDesktopGui_UI})
746 qt4_add_resources(libDesktopGui_RESOURCES_OUT ${libDesktopGui_RESOURCES})
749 add_library(AbookAddressbook STATIC ${libAbookAddressbook_SOURCES} ${libAbookAddressbook_UI_OUT})
750 set_property(TARGET AbookAddressbook APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
751 target_link_libraries(AbookAddressbook ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
753 add_library(DesktopGui STATIC ${libDesktopGui_SOURCES} ${libDesktopGui_UI_OUT} ${libDesktopGui_RESOURCES_OUT})
754 set_property(TARGET DesktopGui APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
755 # The following is needed for the LineEdit widget within the .ui files.
756 # The ${path_DesktopGui} is needed so that the generated ui_*.h file can find the headers of the custom widgets
757 if(SUPPORTS_TARGET_INCLUDES)
758 set_property(TARGET DesktopGui APPEND PROPERTY INCLUDE_DIRECTORIES ${path_DesktopGui})
760 target_link_libraries(DesktopGui Common UiUtils Composer Imap IPC MSA Plugins Streams qwwsmtpclient AbookAddressbook ${QT_QTWEBKIT_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
762 # On Windows build a real Win32 GUI application without console window
763 # On other platforms WIN32 flag is ignored
764 add_executable(trojita WIN32 ${trojita_desktop_SOURCES} ${trojita_QM})
765 set_property(TARGET trojita APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
766 target_link_libraries(trojita AppVersion Common UiUtils DesktopGui ${STATIC_PLUGINS} ${QT_QTMAIN_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
768 target_link_libraries(trojita MimetypesQt4)
771 target_link_libraries(trojita ${ZLIB_LIBRARIES})
774 add_executable(be.contacts ${be_contacts_SOURCES})
775 set_property(TARGET be.contacts APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
776 target_link_libraries(be.contacts AbookAddressbook ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
777 elseif(WITH_HARMATTAN)
778 add_library(trojitaqnamwebviewplugin SHARED ${libQNAMWebView_SOURCES})
779 add_executable(trojita-tp ${trojitaHarmattan_SOURCES})
780 set_property(TARGET trojita-tp APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
781 if(SUPPORTS_TARGET_INCLUDES)
782 set_property(TARGET trojita-tp APPEND PROPERTY INCLUDE_DIRECTORIES
783 ${QT_MKSPECS_DIR}/default ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan/qmlapplicationviewer)
785 target_link_libraries(trojita-tp AppVersion Imap MSA Streams qwwsmtpclient Common Composer MimetypesQt4
786 ${QT_QTSQL_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTWEBKIT_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY})
790 qt5_use_modules(AppVersion Core)
791 qt5_use_modules(Common Core Network)
792 qt5_use_modules(UiUtils Core Gui Network)
793 qt5_use_modules(Streams Network)
794 qt5_use_modules(qwwsmtpclient Network)
795 qt5_use_modules(MSA Network)
796 qt5_use_modules(Composer Gui Network)
797 qt5_use_modules(Imap Gui Network Sql)
799 qt5_use_modules(DesktopGui Network WebKitWidgets)
800 qt5_use_modules(AbookAddressbook Widgets)
801 qt5_use_modules(be.contacts Widgets)
802 qt5_use_modules(trojita Widgets Network)
807 if(WITH_SHARED_PLUGINS)
808 install(TARGETS Plugins DESTINATION ${CMAKE_INSTALL_LIBDIR})
811 include(SanitizedDesktopFile)
814 copy_desktop_file_without_cruft("${CMAKE_CURRENT_SOURCE_DIR}/src/Gui/trojita.desktop" "${CMAKE_CURRENT_BINARY_DIR}/trojita-DesktopGui.desktop")
815 install(TARGETS trojita be.contacts RUNTIME DESTINATION bin)
816 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/trojita-DesktopGui.desktop DESTINATION share/applications/ RENAME trojita.desktop)
817 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/Gui/trojita.appdata.xml DESTINATION share/appdata/)
818 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/icons/trojita.png DESTINATION share/icons/hicolor/32x32/apps/)
819 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/icons/trojita.svg DESTINATION share/icons/hicolor/scalable/apps/)
823 set(trojita_harmattan_path ${CMAKE_CURRENT_SOURCE_DIR}/src/Harmattan)
824 install(TARGETS trojita-tp RUNTIME DESTINATION bin)
825 install(TARGETS trojitaqnamwebviewplugin LIBRARY DESTINATION bin/net/flaska/QNAMWebView)
826 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/QmlSupport/QNAMWebView/qmldir DESTINATION bin/net/flaska/QNAMWebView)
827 install(DIRECTORY ${trojita_harmattan_path}/qml DESTINATION ${CMAKE_INSTALL_PREFIX})
828 install(FILES ${trojita_harmattan_path}/trojita-tp.desktop DESTINATION share/applications)
829 install(FILES ${trojita_harmattan_path}/trojita-tp80.png DESTINATION share/icons/hicolor/80x80/apps)
833 if(CMAKE_SIZEOF_VOID_P STREQUAL 4)
834 set(MAKENSIS_OUTPUT Trojita-installer.exe)
836 set(MAKENSIS_FLAGS -DX86_64 ${MAKENSIS_FLAGS})
837 set(MAKENSIS_OUTPUT Trojita-installer-x86_64.exe)
840 if(NOT CMAKE_VERBOSE_MAKEFILE)
841 set(MAKENSIS_FLAGS -V2 -DQUIET ${MAKENSIS_FLAGS})
844 set(MAKENSIS_FLAGS ${MAKENSIS_FLAGS} -NOCD)
846 add_custom_command(OUTPUT ${MAKENSIS_OUTPUT}
848 ARGS ${MAKENSIS_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/packaging/trojita.nsi
849 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/packaging/trojita.nsi ${CMAKE_CURRENT_BINARY_DIR}/trojita.exe version)
850 add_custom_target(installer ALL DEPENDS ${MAKENSIS_OUTPUT})
855 set(test_LibMailboxSync_SOURCES
856 tests/Utils/ModelEvents.cpp
857 tests/Utils/LibMailboxSync.cpp
859 add_library(test_LibMailboxSync STATIC ${test_LibMailboxSync_SOURCES})
861 qt5_use_modules(test_LibMailboxSync Test Network)
863 if(SUPPORTS_TARGET_INCLUDES)
864 set_property(TARGET test_LibMailboxSync APPEND PROPERTY INCLUDE_DIRECTORIES
865 ${CMAKE_CURRENT_SOURCE_DIR}/tests
866 ${CMAKE_CURRENT_SOURCE_DIR}/tests/Utils)
868 target_link_libraries(test_LibMailboxSync Imap MSA Streams Common Composer ${QT_QTTEST_LIBRARY} ${QT_QTCORE_LIBRARY})
870 macro(trojita_test dir fname)
871 set(test_${fname}_SOURCES tests/${dir}/test_${fname}.cpp)
872 add_executable(test_${fname} ${test_${fname}_SOURCES})
873 target_link_libraries(test_${fname} Imap MSA Streams Common Composer test_LibMailboxSync)
875 qt5_use_modules(test_${fname} Network Sql Test Widgets)
877 target_link_libraries(test_${fname} ${QT_QTSQL_LIBRARY} ${QT_QTTEST_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY})
880 target_link_libraries(test_${fname} ${ZLIB_LIBRARIES})
882 if(SUPPORTS_TARGET_INCLUDES)
883 set_property(TARGET test_${fname} APPEND PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/tests)
885 if(NOT CMAKE_CROSSCOMPILING)
886 add_test(test_${fname} test_${fname})
891 trojita_test(Composer Composer_Submission)
892 trojita_test(Composer Composer_responses)
893 trojita_test(Composer Html_formatting)
895 qt5_use_modules(test_Composer_responses WebKitWidgets)
896 qt5_use_modules(test_Html_formatting WebKitWidgets)
898 target_link_libraries(test_Html_formatting ${QT_QTWEBKIT_LIBRARY})
900 trojita_test(Imap Imap_DisappearingMailboxes)
901 trojita_test(Imap Imap_Idle)
902 trojita_test(Imap Imap_LowLevelParser)
903 trojita_test(Imap Imap_Message)
904 trojita_test(Imap Imap_Model)
905 trojita_test(Imap Imap_MsgPartNetAccessManager)
906 trojita_test(Imap Imap_Parser_parse)
907 trojita_test(Imap Imap_Responses)
908 trojita_test(Imap Imap_SelectedMailboxUpdates)
909 trojita_test(Imap Imap_Tasks_CreateMailbox)
910 trojita_test(Imap Imap_Tasks_DeleteMailbox)
911 trojita_test(Imap Imap_Tasks_ListChildMailboxes)
912 trojita_test(Imap Imap_Tasks_ObtainSynchronizedMailbox)
913 trojita_test(Imap Imap_Tasks_OpenConnection)
914 trojita_test(Imap Imap_Threading)
915 trojita_test(Imap Imap_BodyParts)
916 trojita_test(Imap Imap_Offline)
917 trojita_test(Imap Imap_CopyAndFlagOperations)
918 trojita_test(Misc Rfc5322)
919 trojita_test(Misc RingBuffer)
920 trojita_test(Misc SenderIdentitiesModel)
921 trojita_test(Misc SqlCache)
922 trojita_test(Misc algorithms)
923 trojita_test(Misc rfccodecs)
927 if(WIN32) # Check if we are on Windows
928 if(MSVC10) # Check if we are using the Visual Studio compiler 2010
929 # Because of linker errors (see http://stackoverflow.com/questions/5625884/conversion-of-stdwstring-to-qstring-throws-linker-error)
930 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:wchar_t-")
933 message(WARNING "You are using a compiler which we have not tested yet (not MSVC10 or MINGW).")
934 message(WARNING "Please let us know how well it works.")