Warning, /pim/trojita/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 cmake_minimum_required(VERSION 3.16)
0002
0003 project(trojita)
0004 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
0005
0006 set(CMAKE_CXX_STANDARD 14)
0007 set(CMAKE_CXX_STANDARD_REQUIRED ON)
0008
0009 # Set a default build type if none was specified. This was shamelessly stolen
0010 # from VTK's cmake setup because these guys produce both CMake and a project that
0011 # manipulates this variable, and the web is full of posts where people say that
0012 # it is apparently evil to just set the build type in a way an earlier version of
0013 # this patch did. Oh, and the location of this check/update matters, apparently.
0014 #
0015 # Yes, this is just plain crazy.
0016 if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
0017 message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
0018 set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
0019 # Set the possible values of build type for cmake-gui
0020 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
0021 endif()
0022
0023 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
0024
0025 include(TrojitaOption)
0026
0027 trojita_option(WITH_DESKTOP "Build desktop version" ON)
0028 trojita_option(WITH_DBUS "Build with DBus library" AUTO)
0029 trojita_option(WITH_RAGEL "Build with Ragel library" AUTO)
0030 trojita_option(WITH_ZLIB "Build with zlib library" AUTO)
0031 trojita_option(WITH_SHARED_PLUGINS "Enable shared dynamic plugins" ON)
0032 trojita_option(BUILD_TESTING "Build tests" ON)
0033 trojita_option(WITH_MIMETIC "Build with client-side MIME parsing" AUTO)
0034 trojita_option(WITH_GPGMEPP "Use GpgME's native C++ bindings" AUTO)
0035 trojita_option(WITH_KF5_GPGMEPP "Use legacy discontinued GpgME++ library from KDE frameworks" AUTO)
0036
0037 if(WIN32)
0038 trojita_option(WITH_NSIS "Build Windows NSIS installer" AUTO "WITH_DESKTOP")
0039 endif()
0040
0041 if(UNIX AND NOT APPLE)
0042 set(QTKEYCHAIN_DEPENDS ";WITH_DBUS")
0043 else()
0044 set(QTKEYCHAIN_DEPENDS "")
0045 endif()
0046
0047 find_package(Qt5Core 5.15 REQUIRED)
0048 find_package(Qt5Gui REQUIRED)
0049 find_package(Qt5Network REQUIRED)
0050 find_package(Qt5Sql REQUIRED)
0051 find_package(Qt5WebKitWidgets REQUIRED)
0052 find_package(Qt5Widgets REQUIRED)
0053 find_package(Qt5LinguistTools)
0054 find_package(Qt5Svg REQUIRED)
0055 trojita_find_package(Qt5DBus "" "http://qt-project.org" "Qt5 D-Bus support" "Needed for IPC and for some plugins" WITH_DBUS)
0056 trojita_find_package(Qt5Test "" "http://qt-project.org" "Qt5 QTest library" "Needed for automated tests" BUILD_TESTING)
0057 if(Qt5LinguistTools_FOUND)
0058 find_package(Qt5LinguistForTrojita)
0059 endif()
0060
0061 trojita_find_package(KF5AkonadiContact "" "" "" "Required for building Akonadi address book plugin")
0062
0063 trojita_plugin_option(WITH_ABOOKADDRESSBOOK_PLUGIN "Build AbookAddressbook plugin" STATIC)
0064 trojita_plugin_option(WITH_AKONADIADDRESSBOOK_PLUGIN "Build AkonadiAddressbook plugin" KF5AkonadiContact_FOUND)
0065 trojita_plugin_option(WITH_CLEARTEXT_PLUGIN "Build Cleartext password plugin" STATIC)
0066 trojita_plugin_option(WITH_QTKEYCHAIN_PLUGIN "Build Qtkeychain password plugin" "${QTKEYCHAIN_DEPENDS}")
0067 trojita_plugin_option(WITH_SONNET_PLUGIN "Build a plugin for spellchecking via KDE's Sonnet" "WITH_DESKTOP")
0068
0069 trojita_find_package(Git "" "" "" "")
0070
0071 trojita_find_package(Mimetic "" "http://www.codesink.org/mimetic_mime_library.html" "C++ MIME Library" "Required for client-side MIME parsing" WITH_MIMETIC)
0072 trojita_find_package(Gpgmepp "1.8.0" "https://gnupg.org/related_software/gpgme/index.html" "C++ bindings for gpgme" "Needed for encrypted/signed e-mails" WITH_GPGMEPP)
0073 trojita_find_package(QGpgme "1.8.0" "https://gnupg.org/related_software/gpgme/index.html" "Qt bindings for gpgme" "Needed for encrypted/signed e-mails" WITH_GPGMEPP)
0074 if(NOT WITH_GPGMEPP)
0075 trojita_find_package(KF5Gpgmepp "" "https://commits.kde.org/gpgmepp?path=/" "C++ bindings for gpgme" "Needed for encrypted/signed e-mails" WITH_KF5_GPGMEPP)
0076 trojita_option(WITH_CRYPTO_MESSAGES "Enable support for encrypted messages" AUTO "WITH_MIMETIC;WITH_KF5_GPGMEPP")
0077 else()
0078 trojita_option(WITH_CRYPTO_MESSAGES "Enable support for encrypted messages" AUTO "WITH_MIMETIC;WITH_GPGMEPP")
0079 endif()
0080
0081 if(WIN32)
0082 trojita_find_package(MakeNSIS "" "http://nsis.sourceforge.net" "Nullsoft Scriptable Install System" "Needed for building Windows installer" WITH_NSIS)
0083 endif()
0084
0085 # Add support for Mingw RC compiler
0086 if(WIN32)
0087 enable_language(RC)
0088 include(CMakeDetermineRCCompiler)
0089
0090 if(MINGW)
0091 set(CMAKE_RC_COMPILER_INIT windres)
0092 set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -I${CMAKE_CURRENT_BINARY_DIR} -i <SOURCE> -o <OBJECT>")
0093 endif()
0094 endif()
0095
0096 trojita_find_package(Qt5Keychain QUIET "https://github.com/frankosterfeld/qtkeychain" "QtKeychain library (Qt5 version)" "Needed for QtKeychain password plugin" WITH_QTKEYCHAIN_PLUGIN)
0097 if(Qt5Keychain_FOUND OR QtKeychain_FOUND)
0098 message(STATUS "Found QtKeychain library (includes at ${QTKEYCHAIN_INCLUDE_DIRS}, lib at ${QTKEYCHAIN_LIBRARIES})")
0099 else()
0100 message(STATUS "Could not find QtKeychain library")
0101 endif()
0102
0103 trojita_find_package(KF5Sonnet "" "https://projects.kde.org/projects/frameworks/sonnet" "Qt5 Spell Checking Library from KDE" "Spell checking support" WITH_SONNET_PLUGIN)
0104
0105 if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
0106 set(CMAKE_INSTALL_LIBDIR "lib${LIB_SUFFIX}")
0107 endif()
0108 mark_as_advanced(CMAKE_INSTALL_LIBDIR)
0109
0110 if(NOT CMAKE_INSTALL_PLUGIN_DIR)
0111 set(CMAKE_INSTALL_PLUGIN_DIR "${CMAKE_INSTALL_LIBDIR}/trojita")
0112 endif()
0113 mark_as_advanced(CMAKE_INSTALL_PLUGIN_DIR)
0114
0115 if(NOT PLUGIN_DIR)
0116 if(IS_ABSOLUTE ${CMAKE_INSTALL_PLUGIN_DIR})
0117 set(PLUGIN_DIR "${CMAKE_INSTALL_PLUGIN_DIR}")
0118 else()
0119 set(PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_PLUGIN_DIR}")
0120 endif()
0121 endif()
0122 mark_as_advanced(PLUGIN_DIR)
0123
0124 include(GNUInstallDirs)
0125
0126 # When manipulating CXXFLAGS, we put the user's CXXFLAGS *after* that so that they take priority.
0127 if(MSVC)
0128 # See below for some reationale for these optimizations
0129 set(CMAKE_CXX_FLAGS "/O2 ${CMAKE_CXX_FLAGS}")
0130
0131 # We have no information about the warnings and their usefullness. Reports are welcome.
0132 # We might enable warnings on MSVC in future.
0133 else()
0134 # -Werror is not a default for sanity reasons (one cannot know what warnings a future compiler
0135 # might bring along), but it's a default in debug mode. The idea is that developers should care
0136 # about a warning-free build, and that this is easier than messing with yet another configure option.
0137 # TODO Reenable once the project is warning free
0138 # set(CMAKE_CXX_FLAGS_DEBUG "-Werror ${CMAKE_CXX_FLAGS_DEBUG}")
0139
0140 # Optimizations are enabled unconditionally because they make a big difference in the speed of the
0141 # resulting binaries, and that it is better to allow an opt-out from them by adjusting CXXFLAGS through
0142 # an env var at cmake time if needed.
0143 # The reason for not manipulating just CMAKE_CXX_FLAGS_DEBUG is that unrecognized build types ("DebugFull")
0144 # should still benefit from these optimizations. Yup, it would be even better if CMake did a sane thing
0145 # and warned when users set an unrecognized and unused build type, but that just isn't the case.
0146 set(CMAKE_CXX_FLAGS "-O2 ${CMAKE_CXX_FLAGS}")
0147
0148 # Build warnings are useful tools (and Trojita should be warning-free anyway), enable them on all
0149 # configurations. They are warnings, not errors.
0150 set(CMAKE_CXX_FLAGS "-Wall -Wsign-compare ${CMAKE_CXX_FLAGS}")
0151 endif()
0152
0153 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
0154 # The following is required so that the moc_*.cpp and ui_*.h are found
0155 include_directories(${CMAKE_CURRENT_BINARY_DIR})
0156
0157 add_definitions(-DQT_STRICT_ITERATORS)
0158 add_definitions(-DQT_USE_QSTRINGBUILDER)
0159 add_definitions(-DQT_USE_FAST_OPERATOR_PLUS)
0160 add_definitions(-DQT_USE_FAST_CONCATENATION)
0161 add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
0162
0163 if(NOT MSVC)
0164 # We're using C++11's threading features (std::async in particular), and that requires "some threading". With GCC and
0165 # Clang, this is implemented through the -pthread build flag. Without using these bits, linking fails on Fedora 23,
0166 # and this is apparently a slightly different failure than the Kf5::Gpgmepp-pthread one in commit
0167 # 12e41101070f7073caec653185c0504763672ee7.
0168 #
0169 # Apparently, there's been various methods on how to enable this in the most-cmakeish-way throughout the years, with
0170 # cmake-3.1+ supporting some magic linking via the Threads::Threads option on a per-library basis. However, I am not
0171 # really looking into that wonderful fun of mixing -pthread and non-pthread translation units, so let's use a big
0172 # hammer and set it unconditionally on platforms which use it anyway.
0173 #
0174 # And because we also support MinGW and its `windres` compiler, we have to avoid passing -pthread to *that* thing, so,
0175 # well, let's cheat and put it into the CXXFLAGS.
0176 set(CMAKE_CXX_FLAGS "-pthread ${CMAKE_CXX_FLAGS}")
0177 endif()
0178
0179 # Make sure that plugins not export all symbols, only that which are explicitly marked
0180 include(GenerateExportHeader)
0181 set(CMAKE_C_VISIBILITY_PRESET hidden)
0182 set(CMAKE_CXX_VISIBILITY_PRESET hidden)
0183 set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
0184 set(CMAKE_AUTOMOC True)
0185 set(CMAKE_AUTORCC True)
0186 set(CMAKE_AUTOUIC True)
0187
0188 trojita_find_package(RagelForTrojita "" "" "" "" WITH_RAGEL)
0189 trojita_find_package(ZLIB "" "" "" "" WITH_ZLIB)
0190
0191 if(WITH_MIMETIC)
0192 set(TROJITA_HAVE_MIMETIC True)
0193 else()
0194 set(TROJITA_HAVE_MIMETIC False)
0195 endif()
0196
0197 if(WITH_GPGMEPP OR WITH_KF5_GPGMEPP)
0198 set(TROJITA_HAVE_GPGMEPP True)
0199 else()
0200 set(TROJITA_HAVE_GPGMEPP False)
0201 endif()
0202
0203 if(WITH_CRYPTO_MESSAGES)
0204 set(TROJITA_HAVE_CRYPTO_MESSAGES True)
0205 else()
0206 set(TROJITA_HAVE_CRYPTO_MESSAGES False)
0207 endif()
0208
0209 if(WITH_ZLIB)
0210 set(TROJITA_HAVE_ZLIB True)
0211 message(STATUS "Support for COMPRESS=DEFLATE enabled")
0212 else()
0213 set(TROJITA_HAVE_ZLIB False)
0214 message(STATUS "Disabling COMPRESS=DEFLATE, zlib is not available")
0215 endif()
0216
0217 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/configure.cmake.in
0218 ${CMAKE_CURRENT_BINARY_DIR}/configure.cmake.h)
0219 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/configure-plugins.cmake.in
0220 ${CMAKE_CURRENT_BINARY_DIR}/configure-plugins.cmake.h)
0221
0222 feature_summary(FATAL_ON_MISSING_REQUIRED_PACKAGES INCLUDE_QUIET_PACKAGES DESCRIPTION "\n" WHAT ALL)
0223
0224 set(path_Common ${CMAKE_CURRENT_SOURCE_DIR}/src/Common)
0225 set(libCommon_SOURCES
0226 ${path_Common}/Application.cpp
0227 ${path_Common}/ConnectionId.cpp
0228 ${path_Common}/FileLogger.cpp
0229 ${path_Common}/MetaTypes.cpp
0230 ${path_Common}/Paths.cpp
0231 ${path_Common}/SettingsNames.cpp
0232 ${path_Common}/StashingReverseIterator.h
0233 )
0234
0235 set(path_Plugins ${CMAKE_CURRENT_SOURCE_DIR}/src/Plugins)
0236 set(libPlugins_SOURCES
0237 ${path_Plugins}/AddressbookPlugin.cpp
0238 ${path_Plugins}/PasswordPlugin.cpp
0239 ${path_Plugins}/PluginJob.cpp
0240 ${path_Plugins}/PluginManager.cpp
0241 ${path_Plugins}/SpellcheckerPlugin.cpp
0242 )
0243
0244 set(path_UiUtils ${CMAKE_CURRENT_SOURCE_DIR}/src/UiUtils)
0245 set(libUiUtils_SOURCES
0246 ${path_UiUtils}/Color.cpp
0247 ${path_UiUtils}/Formatting.cpp
0248 ${path_UiUtils}/IconLoader.cpp
0249 ${path_UiUtils}/PartLoadingOptions.h
0250 ${path_UiUtils}/PartVisitor.h
0251 ${path_UiUtils}/PartWalker.h
0252 ${path_UiUtils}/PartWalker_impl.h
0253 ${path_UiUtils}/PasswordWatcher.cpp
0254 ${path_UiUtils}/PlainTextFormatter.cpp
0255 ${path_UiUtils}/QaimDfsIterator.cpp
0256 )
0257
0258 set(path_IPC ${CMAKE_CURRENT_SOURCE_DIR}/src/IPC)
0259
0260 if(WITH_DBUS)
0261 set(libIPC_SOURCES
0262 ${path_IPC}/DBusInterface.cpp
0263 ${path_IPC}/MainWindowBridge.cpp
0264 )
0265 else()
0266 set(libIPC_SOURCES
0267 ${path_IPC}/None.cpp
0268 )
0269 endif()
0270
0271 set(path_Composer ${CMAKE_CURRENT_SOURCE_DIR}/src/Composer)
0272 set(libComposer_SOURCES
0273 ${path_Composer}/AbstractComposer.cpp
0274 ${path_Composer}/ComposerAttachments.cpp
0275 ${path_Composer}/ExistingMessageComposer.cpp
0276 ${path_Composer}/Mailto.cpp
0277 ${path_Composer}/MessageComposer.cpp
0278 ${path_Composer}/QuoteText.cpp
0279 ${path_Composer}/Recipients.cpp
0280 ${path_Composer}/ReplaceSignature.cpp
0281 ${path_Composer}/SenderIdentitiesModel.cpp
0282 ${path_Composer}/SubjectMangling.cpp
0283 ${path_Composer}/Submission.cpp
0284 )
0285
0286 set(path_MSA ${CMAKE_CURRENT_SOURCE_DIR}/src/MSA)
0287 set(libMSA_SOURCES
0288 ${path_MSA}/AbstractMSA.cpp
0289 ${path_MSA}/Account.cpp
0290 ${path_MSA}/FakeMSA.cpp
0291 ${path_MSA}/ImapSubmit.cpp
0292 ${path_MSA}/SMTP.cpp
0293 ${path_MSA}/Sendmail.cpp
0294 )
0295
0296 set(path_Streams ${CMAKE_CURRENT_SOURCE_DIR}/src/Streams)
0297 set(libStreams_SOURCES
0298 ${path_Streams}/DeletionWatcher.cpp
0299 ${path_Streams}/FakeSocket.cpp
0300 ${path_Streams}/IODeviceSocket.cpp
0301 ${path_Streams}/Socket.cpp
0302 ${path_Streams}/SocketFactory.cpp
0303 )
0304
0305 set(path_Cryptography ${CMAKE_CURRENT_SOURCE_DIR}/src/Cryptography)
0306 set(libCryptography_SOURCES
0307 ${path_Cryptography}/MessageModel.cpp
0308 ${path_Cryptography}/MessagePart.cpp
0309 ${path_Cryptography}/PartReplacer.cpp
0310 )
0311 if(WITH_MIMETIC)
0312 set(libCryptography_SOURCES
0313 ${libCryptography_SOURCES}
0314 ${path_Cryptography}/LocalMimeParser.cpp
0315 ${path_Cryptography}/MimeticUtils.cpp
0316 )
0317 endif()
0318 if(WITH_CRYPTO_MESSAGES)
0319 set(libCryptography_SOURCES
0320 ${libCryptography_SOURCES}
0321 ${path_Cryptography}/GpgMe++.cpp
0322 )
0323 endif()
0324
0325 if(WITH_ZLIB)
0326 set(libStreams_SOURCES ${libStreams_SOURCES}
0327 ${path_Streams}/3rdparty/rfc1951.cpp)
0328 endif()
0329
0330 set(path_DesktopGui ${CMAKE_CURRENT_SOURCE_DIR}/src/Gui)
0331 set(libDesktopGui_SOURCES
0332 ${path_DesktopGui}/AddressRowWidget.cpp
0333 ${path_DesktopGui}/AttachmentView.cpp
0334 ${path_DesktopGui}/ColoredItemDelegate.cpp
0335 ${path_DesktopGui}/CompleteMessageWidget.cpp
0336 ${path_DesktopGui}/ComposeWidget.cpp
0337 ${path_DesktopGui}/ComposerAttachmentsList.cpp
0338 ${path_DesktopGui}/ComposerTextEdit.cpp
0339 ${path_DesktopGui}/EmbeddedWebView.cpp
0340 ${path_DesktopGui}/EnvelopeView.cpp
0341 ${path_DesktopGui}/ExternalElementsWidget.cpp
0342 ${path_DesktopGui}/FindBar.cpp
0343 ${path_DesktopGui}/FindBarMixin.cpp
0344 ${path_DesktopGui}/FlowLayout.cpp
0345 ${path_DesktopGui}/FromAddressProxyModel.cpp
0346 ${path_DesktopGui}/LineEdit.cpp
0347 ${path_DesktopGui}/LoadablePartWidget.cpp
0348 ${path_DesktopGui}/MailBoxTreeView.cpp
0349 ${path_DesktopGui}/MessageHeadersWidget.cpp
0350 ${path_DesktopGui}/MessageListWidget.cpp
0351 ${path_DesktopGui}/MessageSourceWidget.cpp
0352 ${path_DesktopGui}/MessageView.cpp
0353 ${path_DesktopGui}/MsgItemDelegate.cpp
0354 ${path_DesktopGui}/MsgListView.cpp
0355 ${path_DesktopGui}/OnePanelAtTimeWidget.cpp
0356 ${path_DesktopGui}/OneEnvelopeAddress.cpp
0357 ${path_DesktopGui}/OverlayWidget.cpp
0358 ${path_DesktopGui}/PartWalker.cpp
0359 ${path_DesktopGui}/PartWidget.cpp
0360 ${path_DesktopGui}/PartWidgetFactoryVisitor.cpp
0361 ${path_DesktopGui}/PasswordDialog.cpp
0362 ${path_DesktopGui}/ProgressPopUp.cpp
0363 ${path_DesktopGui}/ProtocolLoggerWidget.cpp
0364 ${path_DesktopGui}/ReplaceCharValidator.cpp
0365 ${path_DesktopGui}/SettingsDialog.cpp
0366 ${path_DesktopGui}/SimplePartWidget.cpp
0367 ${path_DesktopGui}/Spinner.cpp
0368 ${path_DesktopGui}/TagAddDialog.cpp
0369 ${path_DesktopGui}/TagListWidget.cpp
0370 ${path_DesktopGui}/TagWidget.cpp
0371 ${path_DesktopGui}/TaskProgressIndicator.cpp
0372 ${path_DesktopGui}/UserAgentWebPage.cpp
0373 ${path_DesktopGui}/Util.cpp
0374 ${path_DesktopGui}/Window.cpp
0375 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigDialog.cpp
0376 ${path_DesktopGui}/ShortcutHandler/ShortcutConfigWidget.cpp
0377 ${path_DesktopGui}/ShortcutHandler/ShortcutHandler.cpp
0378
0379 ${CMAKE_CURRENT_SOURCE_DIR}/src/icons.qrc
0380 ${CMAKE_CURRENT_SOURCE_DIR}/src/license.qrc
0381 )
0382
0383 set(libqwwsmtpclient_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/qwwsmtpclient/qwwsmtpclient.cpp)
0384
0385 set(libAppVersion_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/AppVersion/SetCoreApplication.cpp)
0386
0387 set(path_Imap ${CMAKE_CURRENT_SOURCE_DIR}/src/Imap)
0388 set(libImap_SOURCES
0389 ${path_Imap}/ConnectionState.cpp
0390 ${path_Imap}/Encoders.cpp
0391 ${path_Imap}/Exceptions.cpp
0392 ${path_Imap}/Parser/3rdparty/kcodecs.cpp
0393 ${path_Imap}/Parser/3rdparty/rfccodecs.cpp
0394
0395 ${path_Imap}/Parser/Command.cpp
0396 ${path_Imap}/Parser/Data.cpp
0397 ${path_Imap}/Parser/LowLevelParser.cpp
0398 ${path_Imap}/Parser/MailAddress.cpp
0399 ${path_Imap}/Parser/Message.cpp
0400 ${path_Imap}/Parser/Parser.cpp
0401 ${path_Imap}/Parser/Response.cpp
0402 ${path_Imap}/Parser/Sequence.cpp
0403 ${path_Imap}/Parser/ThreadingNode.cpp
0404
0405 ${path_Imap}/Network/FileDownloadManager.cpp
0406 ${path_Imap}/Network/ForbiddenReply.cpp
0407 ${path_Imap}/Network/MsgPartNetAccessManager.cpp
0408 ${path_Imap}/Network/MsgPartNetworkReply.cpp
0409 ${path_Imap}/Network/QQuickNetworkReplyWrapper.cpp
0410
0411 ${path_Imap}/Model/Cache.cpp
0412 ${path_Imap}/Model/CombinedCache.cpp
0413 ${path_Imap}/Model/DragAndDrop.cpp
0414 ${path_Imap}/Model/DiskPartCache.cpp
0415 ${path_Imap}/Model/DummyNetworkWatcher.cpp
0416 ${path_Imap}/Model/FindInterestingPart.cpp
0417 ${path_Imap}/Model/FlagsOperation.cpp
0418 ${path_Imap}/Model/FullMessageCombiner.cpp
0419 ${path_Imap}/Model/ImapAccess.cpp
0420 ${path_Imap}/Model/MailboxFinder.cpp
0421 ${path_Imap}/Model/MailboxMetadata.cpp
0422 ${path_Imap}/Model/MailboxModel.cpp
0423 ${path_Imap}/Model/MailboxTree.cpp
0424 ${path_Imap}/Model/MemoryCache.cpp
0425 ${path_Imap}/Model/Model.cpp
0426 ${path_Imap}/Model/MsgListModel.cpp
0427 ${path_Imap}/Model/NetworkWatcher.cpp
0428 ${path_Imap}/Model/OneMessageModel.cpp
0429 ${path_Imap}/Model/FavoriteTagsModel.cpp
0430 ${path_Imap}/Model/ParserState.cpp
0431 ${path_Imap}/Model/PrettyMailboxModel.cpp
0432 ${path_Imap}/Model/PrettyMsgListModel.cpp
0433 ${path_Imap}/Model/SpecialFlagNames.cpp
0434 ${path_Imap}/Model/SQLCache.cpp
0435 ${path_Imap}/Model/SubtreeModel.cpp
0436 ${path_Imap}/Model/SystemNetworkWatcher.cpp
0437 ${path_Imap}/Model/TaskFactory.cpp
0438 ${path_Imap}/Model/TaskPresentationModel.cpp
0439 ${path_Imap}/Model/ThreadingMsgListModel.cpp
0440 ${path_Imap}/Model/Utils.cpp
0441 ${path_Imap}/Model/VisibleTasksModel.cpp
0442
0443 # The ModelWatcher is another debugging aid
0444 ${path_Imap}/Model/ModelWatcher.cpp
0445
0446 ${path_Imap}/Model/kdeui-itemviews/kdescendantsproxymodel.cpp
0447
0448 ${path_Imap}/Tasks/AppendTask.cpp
0449 ${path_Imap}/Tasks/CopyMoveMessagesTask.cpp
0450 ${path_Imap}/Tasks/CreateMailboxTask.cpp
0451 ${path_Imap}/Tasks/DeleteMailboxTask.cpp
0452 ${path_Imap}/Tasks/EnableTask.cpp
0453 ${path_Imap}/Tasks/ExpungeMailboxTask.cpp
0454 ${path_Imap}/Tasks/ExpungeMessagesTask.cpp
0455 ${path_Imap}/Tasks/Fake_ListChildMailboxesTask.cpp
0456 ${path_Imap}/Tasks/Fake_OpenConnectionTask.cpp
0457 ${path_Imap}/Tasks/FetchMsgMetadataTask.cpp
0458 ${path_Imap}/Tasks/FetchMsgPartTask.cpp
0459 ${path_Imap}/Tasks/GenUrlAuthTask.cpp
0460 ${path_Imap}/Tasks/GetAnyConnectionTask.cpp
0461 ${path_Imap}/Tasks/IdTask.cpp
0462 ${path_Imap}/Tasks/IdleLauncher.cpp
0463 ${path_Imap}/Tasks/ImapTask.cpp
0464 ${path_Imap}/Tasks/KeepMailboxOpenTask.cpp
0465 ${path_Imap}/Tasks/ListChildMailboxesTask.cpp
0466 ${path_Imap}/Tasks/NoopTask.cpp
0467 ${path_Imap}/Tasks/NumberOfMessagesTask.cpp
0468 ${path_Imap}/Tasks/ObtainSynchronizedMailboxTask.cpp
0469 ${path_Imap}/Tasks/OfflineConnectionTask.cpp
0470 ${path_Imap}/Tasks/OpenConnectionTask.cpp
0471 ${path_Imap}/Tasks/SortTask.cpp
0472 ${path_Imap}/Tasks/SubscribeUnsubscribeTask.cpp
0473 ${path_Imap}/Tasks/ThreadTask.cpp
0474 ${path_Imap}/Tasks/UidSubmitTask.cpp
0475 ${path_Imap}/Tasks/UnSelectTask.cpp
0476 ${path_Imap}/Tasks/UpdateFlagsTask.cpp
0477 ${path_Imap}/Tasks/UpdateFlagsOfAllMessagesTask.cpp
0478 )
0479
0480 # The ModelTest is only needed when debugging manually
0481 if (CMAKE_BUILD_TYPE STREQUAL "Debug")
0482 list(APPEND libImap_SOURCES ${path_Imap}/Model/ModelTest/modeltest.cpp)
0483 endif()
0484
0485 if(WITH_RAGEL)
0486 message(STATUS "Using Ragel for the RFC 5322 parser")
0487 ragel_parser(${path_Imap}/Parser/Rfc5322HeaderParser.cpp)
0488 set(libImap_SOURCES ${libImap_SOURCES}
0489 ${CMAKE_CURRENT_BINARY_DIR}/Rfc5322HeaderParser.generated.cpp)
0490 else()
0491 message(STATUS "Using pregenerated RFC 5322 parser")
0492 set(libImap_SOURCES ${libImap_SOURCES}
0493 ${path_Imap}/Parser/Rfc5322HeaderParser.generated.cpp)
0494 endif()
0495
0496 set(trojita_desktop_SOURCES
0497 ${path_DesktopGui}/main.cpp
0498 )
0499
0500 if(WIN32)
0501 list(APPEND trojita_desktop_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/trojita_win32.rc)
0502 set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/trojita_win32.rc APPEND PROPERTY OBJECT_DEPENDS
0503 ${CMAKE_CURRENT_SOURCE_DIR}/src/icons/trojita.ico
0504 ${CMAKE_CURRENT_BINARY_DIR}/trojita-git-version.h
0505 ${CMAKE_CURRENT_BINARY_DIR}/trojita-version.h
0506 )
0507 endif()
0508
0509 if(Qt5LinguistForTrojita_FOUND)
0510 file(GLOB_RECURSE lang_PO "${CMAKE_CURRENT_SOURCE_DIR}/po/trojita_common_*.po")
0511 qt5_wrap_po(trojita_QM ${lang_PO})
0512 set(language_summary "")
0513 foreach(po ${lang_PO})
0514 string(REGEX REPLACE "^(.*)/trojita_common_(.*).po" "\\2" lang ${po})
0515 list(APPEND language_summary ${lang})
0516 endforeach()
0517 list(SORT language_summary)
0518 list(LENGTH language_summary num_languages)
0519 if(num_languages)
0520 message(STATUS "Available languages: ${language_summary}")
0521 if(WITH_DESKTOP)
0522 install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/locale/ DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/trojita/locale" REGEX "(x_test)|(.*\\.ts)" EXCLUDE)
0523 endif()
0524 else()
0525 message(STATUS "No .po files found, will not install any languages")
0526 endif()
0527 else()
0528 message(STATUS "Qt Linguist (lupdate/lrelease/lconvert) not found, disabling localization support")
0529 endif()
0530
0531 set(version_files ${CMAKE_CURRENT_BINARY_DIR}/trojita-version.h ${CMAKE_CURRENT_BINARY_DIR}/trojita-git-version.h)
0532 if(WITH_NSIS)
0533 set(version_files ${version_files} ${CMAKE_CURRENT_BINARY_DIR}/trojita-version.nsi)
0534 set(NSIS TRUE)
0535 endif()
0536
0537 add_custom_target(version DEPENDS version_fake_file)
0538 add_custom_command(OUTPUT version_fake_file ${version_files}
0539 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)
0540 set_source_files_properties(${version_files}
0541 PROPERTIES GENERATED TRUE
0542 HEADER_FILE_ONLY TRUE)
0543
0544 add_library(Common STATIC ${libCommon_SOURCES})
0545 set_property(TARGET Common APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
0546 add_dependencies(Common version)
0547 target_link_libraries(Common Qt5::Network)
0548
0549 add_library(AppVersion STATIC ${libAppVersion_SOURCES})
0550 set_property(TARGET AppVersion APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
0551 add_dependencies(AppVersion version)
0552 target_link_libraries(AppVersion Common)
0553 target_link_libraries(AppVersion Qt5::Core)
0554
0555 if(WITH_SHARED_PLUGINS)
0556 add_library(Plugins SHARED ${libPlugins_SOURCES})
0557 set_property(TARGET Plugins APPEND PROPERTY COMPILE_DEFINITIONS BUILDING_LIBTROJITA_PLUGINS)
0558 else()
0559 add_library(Plugins STATIC ${libPlugins_SOURCES})
0560 set_property(TARGET Plugins APPEND PROPERTY COMPILE_DEFINITIONS QT_STATICPLUGIN)
0561 endif()
0562 set_target_properties(Plugins PROPERTIES OUTPUT_NAME trojita_plugins)
0563 set_property(TARGET Plugins APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
0564 target_link_libraries(Plugins Qt5::Core)
0565
0566 add_library(UiUtils STATIC ${libUiUtils_SOURCES})
0567 set_property(TARGET UiUtils APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
0568 target_link_libraries(UiUtils Plugins Common Qt5::Gui)
0569
0570 add_library(Streams STATIC ${libStreams_SOURCES})
0571 set_property(TARGET Streams APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
0572 if(WITH_ZLIB)
0573 target_link_libraries(Streams ZLIB::ZLIB)
0574 endif()
0575 target_link_libraries(Streams Qt5::Network)
0576
0577 add_library(IPC STATIC ${libIPC_SOURCES})
0578 set_property(TARGET IPC APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
0579 if(WITH_DBUS)
0580 target_link_libraries(IPC Qt5::DBus Qt5::Widgets)
0581 else()
0582 target_link_libraries(IPC Qt5::Core)
0583 endif()
0584
0585 add_library(qwwsmtpclient STATIC ${libqwwsmtpclient_SOURCES})
0586 target_link_libraries(qwwsmtpclient Qt5::Network)
0587
0588 add_library(MSA STATIC ${libMSA_SOURCES})
0589 set_property(TARGET MSA APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
0590 target_link_libraries(MSA Imap Streams qwwsmtpclient)
0591
0592 add_library(Composer STATIC ${libComposer_SOURCES})
0593 set_property(TARGET Composer APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
0594 target_link_libraries(Composer Common MSA Streams UiUtils qwwsmtpclient)
0595
0596 add_library(Imap STATIC ${libImap_SOURCES})
0597 set_property(TARGET Imap APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
0598 target_link_libraries(Imap Common Streams UiUtils Qt5::Sql)
0599
0600 add_library(Cryptography STATIC ${libCryptography_SOURCES})
0601 set_property(TARGET Cryptography APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
0602 target_link_libraries(Cryptography Common Imap)
0603 if(WITH_MIMETIC)
0604 target_link_libraries(Cryptography Mimetic::Mimetic)
0605 endif()
0606 if(WITH_CRYPTO_MESSAGES)
0607 if(WITH_GPGMEPP)
0608 target_link_libraries(Cryptography Gpgmepp QGpgme)
0609 elseif(WITH_KF5_GPGMEPP)
0610 if(WIN32)
0611 target_link_libraries(Cryptography KF5::Gpgmepp KF5::QGpgme)
0612 else()
0613 target_link_libraries(Cryptography KF5::Gpgmepp-pthread KF5::QGpgme)
0614 endif()
0615 endif()
0616 endif()
0617
0618 ## ClearText password plugin
0619 if(WITH_CLEARTEXT_PLUGIN)
0620 trojita_add_plugin(trojita_plugin_ClearTextPasswordPlugin WITH_CLEARTEXT_PLUGIN src/Plugins/ClearTextPassword/ClearTextPassword.cpp)
0621 endif()
0622
0623 ## QtKeyChain plugin
0624 if(WITH_QTKEYCHAIN_PLUGIN)
0625 trojita_add_plugin(trojita_plugin_QtKeychainPasswordPlugin WITH_QTKEYCHAIN_PLUGIN src/Plugins/QtKeyChain/QtKeyChainPassword.cpp)
0626 target_link_libraries(trojita_plugin_QtKeychainPasswordPlugin qt5keychain Qt5::DBus)
0627 endif()
0628
0629 ## AbookAddressbook plugin
0630 if(WITH_ABOOKADDRESSBOOK_PLUGIN)
0631 set(path_AbookAddressbook ${CMAKE_CURRENT_SOURCE_DIR}/src/Plugins/AbookAddressbook)
0632 set(libAbookAddressbook_HEADERS
0633 ${path_AbookAddressbook}/AbookAddressbook.h
0634 ${path_AbookAddressbook}/be-contacts.h
0635 )
0636 set(libAbookAddressbook_SOURCES
0637 ${path_AbookAddressbook}/AbookAddressbook.cpp
0638 ${path_AbookAddressbook}/be-contacts.cpp
0639 )
0640
0641 trojita_add_plugin(trojita_plugin_AbookAddressbookPlugin WITH_ABOOKADDRESSBOOK_PLUGIN ${libAbookAddressbook_SOURCES})
0642 set_property(TARGET trojita_plugin_AbookAddressbookPlugin APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
0643
0644 target_link_libraries(trojita_plugin_AbookAddressbookPlugin Qt5::Widgets)
0645
0646 set(be_contacts_SOURCES
0647 ${path_AbookAddressbook}/main.cpp
0648 )
0649
0650 add_executable(be.contacts WIN32 ${be_contacts_SOURCES})
0651 set_property(TARGET be.contacts APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
0652 target_link_libraries(be.contacts Plugins)
0653 if("${WITH_ABOOKADDRESSBOOK_PLUGIN}" STREQUAL "STATIC")
0654 set_property(TARGET be.contacts APPEND PROPERTY COMPILE_DEFINITIONS QT_STATICPLUGIN)
0655 target_link_libraries(be.contacts trojita_plugin_AbookAddressbookPlugin)
0656 endif()
0657 target_link_libraries(be.contacts Qt5::Widgets)
0658 endif()
0659
0660 ## AkonadiAddressbook plugin
0661 if(WITH_AKONADIADDRESSBOOK_PLUGIN)
0662 set(path_AkonadiAddressbook ${CMAKE_CURRENT_SOURCE_DIR}/src/Plugins/AkonadiAddressbook)
0663 set(libAkonadiAddressbook_HEADERS
0664 ${path_AkonadiAddressbook}/AkonadiAddressbook.h
0665 ${path_AkonadiAddressbook}/AkonadiAddressbookCompletionJob.h
0666 ${path_AkonadiAddressbook}/AkonadiAddressbookNamesJob.h
0667 )
0668 set(libAkonadiAddressbook_SOURCES
0669 ${path_AkonadiAddressbook}/AkonadiAddressbook.cpp
0670 ${path_AkonadiAddressbook}/AkonadiAddressbookCompletionJob.cpp
0671 ${path_AkonadiAddressbook}/AkonadiAddressbookNamesJob.cpp
0672 )
0673
0674 trojita_add_plugin(trojita_plugin_AkonadiAddressbookPlugin WITH_AKONADIADDRESSBOOK_PLUGIN ${libAkonadiAddressbook_SOURCES})
0675 target_link_libraries(trojita_plugin_AkonadiAddressbookPlugin KF5::AkonadiContact)
0676 set_property(TARGET trojita_plugin_AkonadiAddressbookPlugin APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
0677 endif()
0678
0679 if(WITH_SONNET_PLUGIN)
0680 trojita_add_plugin(trojita_plugin_Sonnet WITH_SONNET_PLUGIN src/Plugins/SonnetSpellchecker/SonnetSpellchecker.cpp)
0681 set_property(TARGET trojita_plugin_Sonnet APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
0682 target_link_libraries(trojita_plugin_Sonnet KF5::SonnetUi)
0683 endif()
0684
0685 # Generate file static_plugins.h.in
0686 get_property(STATIC_PLUGINS GLOBAL PROPERTY TROJITA_STATIC_PLUGINS)
0687 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/static_plugins.h.in "#include <QtPlugin>\n")
0688 foreach(PLUGIN ${STATIC_PLUGINS})
0689 file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/static_plugins.h.in "Q_IMPORT_PLUGIN(${PLUGIN})\n")
0690 endforeach()
0691 execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/static_plugins.h.in ${CMAKE_CURRENT_BINARY_DIR}/static_plugins.h)
0692
0693 if(WITH_DESKTOP)
0694 add_library(DesktopGui STATIC ${libDesktopGui_SOURCES})
0695 set_property(TARGET DesktopGui APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
0696 # The following is needed for the LineEdit widget within the .ui files.
0697 # The ${path_DesktopGui} is needed so that the generated ui_*.h file can find the headers of the custom widgets
0698 set_property(TARGET DesktopGui APPEND PROPERTY INCLUDE_DIRECTORIES ${path_DesktopGui})
0699 target_link_libraries(DesktopGui Common UiUtils Composer Cryptography Imap IPC MSA Plugins Streams qwwsmtpclient Qt5::WebKitWidgets)
0700
0701 # On Windows build a real Win32 GUI application without console window
0702 # On other platforms WIN32 flag is ignored
0703 add_executable(trojita WIN32 ${trojita_desktop_SOURCES} ${trojita_QM})
0704 set_property(TARGET trojita APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII)
0705 target_link_libraries(trojita AppVersion Common UiUtils DesktopGui ${STATIC_PLUGINS})
0706
0707 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/docs/trojita.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
0708 endif()
0709
0710
0711 if(WITH_SHARED_PLUGINS)
0712 install(TARGETS Plugins DESTINATION ${CMAKE_INSTALL_LIBDIR})
0713 endif()
0714
0715 include(SanitizedDesktopFile)
0716
0717 if(WITH_ABOOKADDRESSBOOK_PLUGIN)
0718 install(TARGETS be.contacts RUNTIME DESTINATION bin)
0719 endif()
0720
0721 if(WITH_DESKTOP)
0722 copy_desktop_file_without_cruft("${CMAKE_CURRENT_SOURCE_DIR}/src/Gui/org.kde.trojita.desktop" "${CMAKE_CURRENT_BINARY_DIR}/org.kde.trojita-DesktopGui.desktop")
0723 install(TARGETS trojita RUNTIME DESTINATION bin)
0724 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.trojita-DesktopGui.desktop DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications/" RENAME org.kde.trojita.desktop)
0725 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/Gui/org.kde.trojita.appdata.xml DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo/")
0726 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/icons/trojita.png DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps/")
0727 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/icons/trojita.svg DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps/")
0728 endif()
0729
0730 if(WITH_NSIS)
0731 include(TrojitaNSIS)
0732 endif()
0733
0734
0735 if(BUILD_TESTING)
0736 set(test_LibMailboxSync_SOURCES
0737 tests/Utils/ModelEvents.cpp
0738 tests/Utils/LibMailboxSync.cpp
0739 )
0740 add_library(test_LibMailboxSync STATIC ${test_LibMailboxSync_SOURCES})
0741 set_property(TARGET test_LibMailboxSync APPEND PROPERTY INCLUDE_DIRECTORIES
0742 ${CMAKE_CURRENT_SOURCE_DIR}/tests
0743 ${CMAKE_CURRENT_SOURCE_DIR}/tests/Utils)
0744 target_link_libraries(test_LibMailboxSync Imap MSA Streams Common Composer Qt5::Test)
0745
0746 macro(trojita_test dir fname)
0747 set(test_${fname}_SOURCES tests/${dir}/test_${fname}.cpp)
0748 add_executable(test_${fname} ${test_${fname}_SOURCES})
0749 target_link_libraries(test_${fname} Imap MSA Streams Common Composer Cryptography test_LibMailboxSync)
0750 set_property(TARGET test_${fname} APPEND PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/tests)
0751 if(NOT CMAKE_CROSSCOMPILING)
0752 add_test(test_${fname} test_${fname})
0753 endif()
0754 endmacro()
0755
0756 set(UBSAN_ENV_SUPPRESSIONS "UBSAN_OPTIONS=suppressions=${CMAKE_CURRENT_SOURCE_DIR}/tests/ubsan.supp")
0757
0758 enable_testing()
0759 trojita_test(Composer Composer_Submission)
0760 trojita_test(Composer Composer_Existing)
0761 trojita_test(Composer Composer_responses)
0762 target_link_libraries(test_Composer_responses Qt5::WebKitWidgets)
0763 trojita_test(Composer Html_formatting)
0764 target_link_libraries(test_Html_formatting Qt5::WebKitWidgets)
0765 trojita_test(Imap Imap_DisappearingMailboxes)
0766 trojita_test(Imap Imap_Idle)
0767 trojita_test(Imap Imap_LowLevelParser)
0768 trojita_test(Imap Imap_Message)
0769 trojita_test(Imap Imap_Model)
0770 trojita_test(Imap Imap_MsgPartNetAccessManager)
0771 set_property(TEST test_Imap_MsgPartNetAccessManager PROPERTY ENVIRONMENT "${UBSAN_ENV_SUPPRESSIONS}")
0772 trojita_test(Imap Imap_Parser_parse)
0773 trojita_test(Imap Imap_Parser_write)
0774 trojita_test(Imap Imap_Responses)
0775 trojita_test(Imap Imap_SelectedMailboxUpdates)
0776 trojita_test(Imap Imap_Tasks_CreateMailbox)
0777 trojita_test(Imap Imap_Tasks_DeleteMailbox)
0778 trojita_test(Imap Imap_Tasks_ListChildMailboxes)
0779 trojita_test(Imap Imap_Tasks_ObtainSynchronizedMailbox)
0780 trojita_test(Imap Imap_Tasks_OpenConnection)
0781 trojita_test(Imap Imap_Threading)
0782 trojita_test(Imap Imap_BodyParts)
0783 trojita_test(Imap Imap_Offline)
0784 trojita_test(Imap Imap_CopyAndFlagOperations)
0785 trojita_test(Cryptography Cryptography_MessageModel)
0786
0787 if(WITH_CRYPTO_MESSAGES)
0788 find_program(GPGCONF_BINARY NAMES gpgconf)
0789 if(GPGCONF_BINARY_NOTFOUND)
0790 message(SEND_ERROR "The `gpgconf` binary from GnuPG not found, this is needed for crypto tests.")
0791 endif()
0792
0793 if(NOT UNIX)
0794 message(SEND_ERROR "The Cryptography unit tests really need Unix. Patches welcome.")
0795 endif()
0796
0797 add_library(fake-dev-random SHARED ${CMAKE_CURRENT_SOURCE_DIR}/tests/Utils/fake-dev-random.c)
0798 set_target_properties(fake-dev-random PROPERTIES AUTOMOC off)
0799 target_link_libraries(fake-dev-random ${CMAKE_DL_LIBS})
0800
0801 # FIXME: it would be nice to depend on the contents of keys/, but in my testing it produces Makefiles
0802 # which suffer from races (the keygen.sh is run multiple times in parallel within the CI environment).
0803 # I wasn't able to track down the root cause behind this; it affected all cmake versions within the CI
0804 # as of Feb 2016, which is 3.1.something up to 3.3.something.
0805 add_custom_command(OUTPUT crypto_test_data.h
0806 COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/tests/Cryptography/keygen.sh ${CMAKE_CURRENT_SOURCE_DIR}
0807 DEPENDS fake-dev-random tests/Cryptography/keygen.sh tests/Cryptography/batch-keygen)
0808 add_custom_target(crypto_test_data DEPENDS crypto_test_data.h)
0809
0810 trojita_test(Cryptography Cryptography_PGP)
0811 set_property(TEST test_Cryptography_PGP PROPERTY ENVIRONMENT "${UBSAN_ENV_SUPPRESSIONS}")
0812 add_dependencies(test_Cryptography_PGP crypto_test_data)
0813 endif()
0814
0815 trojita_test(Misc Rfc5322)
0816 trojita_test(Misc RingBuffer)
0817 trojita_test(Misc SenderIdentitiesModel)
0818 trojita_test(Misc SqlCache)
0819 trojita_test(Misc algorithms)
0820 trojita_test(Misc rfccodecs)
0821 trojita_test(Misc prettySize)
0822 trojita_test(Misc Formatting)
0823 trojita_test(Misc QaimDfsIterator)
0824 trojita_test(Misc FavoriteTagsModel)
0825
0826 endif()
0827
0828 if(WIN32) # Check if we are on Windows
0829 if(MSVC10) # Check if we are using the Visual Studio compiler 2010
0830 # Because of linker errors (see http://stackoverflow.com/questions/5625884/conversion-of-stdwstring-to-qstring-throws-linker-error)
0831 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:wchar_t-")
0832 elseif(MINGW)
0833 else()
0834 message(WARNING "You are using a compiler which we have not tested yet (not MSVC10 or MINGW).")
0835 message(WARNING "Please let us know how well it works.")
0836 endif()
0837 endif()