CMakeLists.txt 3.17 KB
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
Laurent Montel's avatar
Laurent Montel committed
2
set(PIM_VERSION "5.16.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.78.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 14)
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)
Laurent Montel's avatar
Laurent Montel committed
25
26
27
if(ECM_VERSION VERSION_GREATER_EQUAL 5.79)
   include(KDEGitCommitHooks)
endif()
Laurent Montel's avatar
Laurent Montel committed
28
include(ECMInstallIcons)
Laurent Montel's avatar
Laurent Montel committed
29
include(ECMQtDeclareLoggingCategory)
30

Laurent Montel's avatar
Laurent Montel committed
31

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

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

53
54
find_package(KF5Contacts ${KF5_MIN_VERSION} CONFIG REQUIRED)

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

59
if (NOT WIN32)
60
61
    set_package_properties(KF5Libkleo PROPERTIES TYPE REQUIRED)
endif()
62

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

65
find_package(Grantlee5 ${GRANTLEE_LIB_VERSION} CONFIG REQUIRED)
66

Laurent Montel's avatar
Laurent Montel committed
67
68
########### Targets ###########

69

70
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050e00)
71
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054F00)
72

Laurent Montel's avatar
Laurent Montel committed
73
add_definitions(-DQT_NO_FOREACH)
74
add_definitions(-DQT_NO_KEYWORDS)
Kevin Funk's avatar
Kevin Funk committed
75
76
77
if(BUILD_TESTING)
   add_definitions(-DBUILD_TESTING)
endif()
Laurent Montel's avatar
Laurent Montel committed
78

Laurent Montel's avatar
Laurent Montel committed
79
option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" FALSE)
80

Laurent Montel's avatar
Laurent Montel committed
81
82
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT false)
if (USE_UNITY_CMAKE_SUPPORT)
83
84
85
    if(${CMAKE_VERSION} VERSION_LESS "3.16.0")
        message(STATUS "CMAKE version is less than 3.16.0 . We can't use cmake unify build support")
    else()
Laurent Montel's avatar
Laurent Montel committed
86
        set(COMPILE_WITH_UNITY_CMAKE_SUPPORT true)
87
88
89
    endif()
endif()

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

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

100

Laurent Montel's avatar
Laurent Montel committed
101
102
103
if(ECM_VERSION VERSION_GREATER_EQUAL 5.79)
    kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
endif()
104
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)