CMakeLists.txt 3.15 KB
Newer Older
1
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
2
set(PIM_VERSION "5.17.40")
Laurent Montel's avatar
Laurent Montel committed
3

4
project(Akonadi-Contact VERSION ${PIM_VERSION})
Laurent Montel's avatar
Laurent Montel committed
5
6

# ECM setup
Laurent Montel's avatar
Laurent Montel committed
7

8
set(KF5_MIN_VERSION "5.81.0")
Laurent Montel's avatar
Laurent Montel committed
9

10
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
11
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
12
set(CMAKE_CXX_STANDARD 17)
13
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Laurent Montel's avatar
Laurent Montel committed
14

15
16
17
18
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)

Laurent Montel's avatar
Laurent Montel committed
19
20
21
include(GenerateExportHeader)
include(ECMGenerateHeaders)
include(ECMGeneratePriFile)
22

Laurent Montel's avatar
Laurent Montel committed
23
24
include(ECMSetupVersion)
include(FeatureSummary)
25
include(KDEGitCommitHooks)
Laurent Montel's avatar
Laurent Montel committed
26
include(ECMInstallIcons)
Laurent Montel's avatar
Laurent Montel committed
27
include(ECMQtDeclareLoggingCategory)
28

Laurent Montel's avatar
Laurent Montel committed
29

Laurent Montel's avatar
Laurent Montel committed
30
set(AKONADI_CONTACTS_VERSION ${PIM_VERSION})
31
32
33
34
set(KMIMELIB_VERSION "5.17.40")
set(AKONADI_VERSION "5.17.40")
set(LIBKLEO_LIB_VERSION "5.17.40")
set(GRANTLEETHEME_LIB_VERSION "5.17.40")
35
set(GRANTLEE_LIB_VERSION "5.2")
Laurent Montel's avatar
Laurent Montel committed
36

37
set(QT_REQUIRED_VERSION "5.15.0")
Laurent Montel's avatar
Laurent Montel committed
38
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Test)
Laurent Montel's avatar
Laurent Montel committed
39
########### Find packages ###########
40
41
42
find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Completion ${KF5_MIN_VERSION} CONFIG REQUIRED)
43
find_package(KF5Config ${KF5_MIN_VERSION} CONFIG REQUIRED)
44
find_package(KF5IconThemes ${KF5_MIN_VERSION} CONFIG REQUIRED)
45
find_package(KF5Service ${KF5_MIN_VERSION} CONFIG REQUIRED)
46
find_package(KF5TextWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED)
47
48
find_package(KF5WidgetsAddons ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5XmlGui ${KF5_MIN_VERSION} CONFIG REQUIRED)
49
find_package(KF5Prison ${KF5_MIN_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
50

51
52
find_package(KF5Contacts ${KF5_MIN_VERSION} CONFIG REQUIRED)

Laurent Montel's avatar
Laurent Montel committed
53
find_package(KF5Mime ${KMIMELIB_VERSION} CONFIG REQUIRED)
Daniel Vrátil's avatar
Daniel Vrátil committed
54
find_package(KF5Akonadi ${AKONADI_VERSION} CONFIG REQUIRED)
55
find_package(KF5Libkleo ${LIBKLEO_LIB_VERSION} CONFIG)
56

57
if (NOT WIN32)
58
59
    set_package_properties(KF5Libkleo PROPERTIES TYPE REQUIRED)
endif()
60

61
find_package(KF5GrantleeTheme ${GRANTLEETHEME_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
62

63
find_package(Grantlee5 ${GRANTLEE_LIB_VERSION} CONFIG REQUIRED)
64

Ömer Fadıl Usta's avatar
Ömer Fadıl Usta committed
65
66
67
68
69
70
71
72
############### Compilers flags ###############

if (MSVC)
    # This sets the __cplusplus macro to a real value based on the version of C++ specified by
    # the /std switch. Without it MSVC keeps reporting C++98, so feature detection doesn't work.
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus")
endif()

Laurent Montel's avatar
Laurent Montel committed
73
74
########### Targets ###########

75

76
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050e00)
77
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055200)
78

Kevin Funk's avatar
Kevin Funk committed
79
80
81
if(BUILD_TESTING)
   add_definitions(-DBUILD_TESTING)
endif()
82
option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" OFF)
Laurent Montel's avatar
Laurent Montel committed
83

84
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT OFF)
Laurent Montel's avatar
Laurent Montel committed
85
if (USE_UNITY_CMAKE_SUPPORT)
86
    set(COMPILE_WITH_UNITY_CMAKE_SUPPORT ON)
87
88
endif()

Laurent Montel's avatar
Laurent Montel committed
89
add_subdirectory(src)
Laurent Montel's avatar
Laurent Montel committed
90
add_subdirectory(kcm)
91
add_subdirectory(serializers)
Laurent Montel's avatar
Laurent Montel committed
92

93
ecm_qt_install_logging_categories(
Laurent Montel's avatar
Laurent Montel committed
94
95
96
97
98
        EXPORT AKONADICONTACTS
        FILE akonadi-contacts.categories
        DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
        )

99

100
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
101
ki18n_install(po)
102
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)