summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: 451b33a4dd357cabf0958ada1d3ea1fb6da89cf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
cmake_minimum_required(VERSION 3.16)

project(QtMessagingFramework
  VERSION 4.0.4
  DESCRIPTION "a C++ library and daemon server process to build email clients")

set(CMAKE_AUTOMOC ON)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 11)

option(BUILD_WIDGETS "Build widgets" OFF)
option(BUILD_DOCS "Build documentation" OFF)
option(USE_HTML_PARSER "Use HTML parser to handle rich text" OFF)
option(USE_ACCOUNTS_QT "Use libaccounts-qt to handle mail account" OFF)

include(FeatureSummary)
include(GNUInstallDirs)
include(CTest)

find_package(PkgConfig REQUIRED)

find_package(Qt6 REQUIRED COMPONENTS Core Xml DBus Sql Network Core5Compat OPTIONAL_COMPONENTS LinguistTools)
if(BUILD_WIDGETS)
find_package(Qt6 REQUIRED COMPONENTS Widgets)
endif()
if(USE_HTML_PARSER)
find_package(Qt6 REQUIRED COMPONENTS Gui)
endif()

find_package(ZLIB)
if(NOT ZLIB_FOUND)
  message("Zlib not found, IMAP COMPRESS support disabled")
endif()

if(USE_ACCOUNTS_QT)
  pkg_check_modules(LIBACCOUNTS REQUIRED accounts-qt6 IMPORTED_TARGET)
endif()
if(BUILD_TESTING)
  find_package(Qt6 REQUIRED COMPONENTS Test)
endif()
pkg_check_modules(ICU icu-i18n IMPORTED_TARGET)

# it might be possible to get this functionality from Qt cmake content but those seem buried there
# inside bigger modules
find_package(ECM NO_MODULE)
if (ECM_FOUND)
  set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
  include(ECMGeneratePkgConfigFile)
  include(ECMQueryQt)
  include(ECMGenerateQDoc)
else()
  message("Extra-cmake-modules (ecm) not found, pkgconfig files won't be generated")
endif()

# there's probably some better compiler agnostic way to enable more warnings, but this is a start
add_compile_options(-Wall -Wextra -Wpedantic)

add_subdirectory(src)
if(BUILD_TESTING)
  add_subdirectory(tests)
endif()
add_subdirectory(benchmarks)
add_subdirectory(examples)

# TODO: translation support is missing quite a bit. Defining here just some basic ones
# in case someone feels like getting them working some day
if (TARGET Qt6::LinguistTools)
  qt_standard_project_setup(I18N_TRANSLATED_LANGUAGES de en_US)
endif()

feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)