CMakeLists.txt 3.43 KB
Newer Older
1
cmake_minimum_required(VERSION 3.0)
Laurent Montel's avatar
Laurent Montel committed
2

Laurent Montel's avatar
Laurent Montel committed
3
set(PIM_VERSION "5.6.1")
4
project(AkonadiSearch VERSION ${PIM_VERSION})
5

Vishesh Handa's avatar
Vishesh Handa committed
6
# ECM setup
7
set(KF5_VERSION "5.35.0")
Laurent Montel's avatar
Laurent Montel committed
8
find_package(ECM ${KF5_VERSION} REQUIRED NO_MODULE)
Vishesh Handa's avatar
Vishesh Handa committed
9
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
10

Vishesh Handa's avatar
Vishesh Handa committed
11
12
include(GenerateExportHeader)
include(ECMGenerateHeaders)
Laurent Montel's avatar
Laurent Montel committed
13
include(CMakePackageConfigHelpers)
Vishesh Handa's avatar
Vishesh Handa committed
14
15
16
17
include(ECMSetupVersion)
include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
18
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
Vishesh Handa's avatar
Vishesh Handa committed
19
20
include(ECMInstallIcons)
include(ECMAddTests)
21
include(ECMQtDeclareLoggingCategory)
Laurent Montel's avatar
Laurent Montel committed
22
23
include(ECMCoverageOption)

24

25

Laurent Montel's avatar
Laurent Montel committed
26
27

set(AKONADISEARCH_VERSION ${PIM_VERSION})
28

Laurent Montel's avatar
Laurent Montel committed
29
30
31
32
33
set(AKONADI_VERSION "5.6.1")
set(AKONADI_MIMELIB_VERSION "5.6.1")
set(KCONTACTS_LIB_VERSION "5.6.1")
set(KCALENDARCORE_LIB_VERSION "5.6.1")
set(KMIME_LIB_VERSION "5.6.1")
34
set(QT_REQUIRED_VERSION "5.7.0")
35

36
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Core Test)
37
38
39
40
find_package(KF5 ${KF5_VERSION} REQUIRED COMPONENTS I18n Config Crash KCMUtils)
if (NOT WIN32)
    find_package(KF5Runner ${KF5_VERSION} REQUIRED)
endif()
41

Laurent Montel's avatar
Laurent Montel committed
42

Vishesh Handa's avatar
Vishesh Handa committed
43
44
45
46
47
48
49
find_package(Xapian CONFIG)
set_package_properties(Xapian PROPERTIES
    DESCRIPTION "The Xapian search engine library"
    URL "http://xapian.org"
    TYPE REQUIRED
)

50
find_package(KF5Akonadi ${AKONADI_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
51
52
find_package(KF5Contacts ${KCONTACTS_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
53
find_package(KF5AkonadiMime ${AKONADI_MIMELIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
54
find_package(KF5CalendarCore ${KCALENDARCORE_LIB_VERSION} CONFIG REQUIRED)
Vishesh Handa's avatar
Vishesh Handa committed
55

56
ecm_setup_version(PROJECT
Vishesh Handa's avatar
Vishesh Handa committed
57
58
    VARIABLE_PREFIX AKONADISEARCH
    VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/akonadi_search_version.h"
59
    PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiSearchConfigVersion.cmake"
Vishesh Handa's avatar
Vishesh Handa committed
60
61
62
    SOVERSION 5
)

Vishesh Handa's avatar
Vishesh Handa committed
63
64
# Compiler flags
add_definitions(-DQT_NO_KEYWORDS)
Laurent Montel's avatar
Laurent Montel committed
65
66
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_definitions(-DQT_USE_QSTRINGBUILDER)
67
add_definitions(-DTRANSLATION_DOMAIN=\"akonadi_search\")
Vishesh Handa's avatar
Vishesh Handa committed
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

# Turn exceptions on
kde_enable_exceptions()

include_directories(
  ${XAPIAN_INCLUDE_DIR}
  ${CMAKE_SOURCE_DIR}
  ${CMAKE_SOURCE_DIR}/core
  ${CMAKE_BINARY_DIR}/core
  ${CMAKE_SOURCE_DIR}/xapian
  ${CMAKE_BINARY_DIR}/xapian
)

# Targets
add_subdirectory(xapian)
add_subdirectory(core)
add_subdirectory(agent)
add_subdirectory(lib)
add_subdirectory(akonadiplugin)
Vishesh Handa's avatar
Vishesh Handa committed
87
add_subdirectory(search)
Laurent Montel's avatar
Laurent Montel committed
88
add_subdirectory(debug)
89
90
91
if (NOT WIN32)
    add_subdirectory(runner)
endif()
Vishesh Handa's avatar
Vishesh Handa committed
92
93

# Config files
94
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5AkonadiSearch")
Vishesh Handa's avatar
Vishesh Handa committed
95

96
configure_package_config_file(
97
98
    "${CMAKE_CURRENT_SOURCE_DIR}/KF5AkonadiSearchConfig.cmake.in"
    "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiSearchConfig.cmake"
Vishesh Handa's avatar
Vishesh Handa committed
99
100
101
102
    INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)

install(FILES
103
104
    "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiSearchConfig.cmake"
    "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiSearchConfigVersion.cmake"
Vishesh Handa's avatar
Vishesh Handa committed
105
106
107
108
    DESTINATION ${CMAKECONFIG_INSTALL_DIR}
    COMPONENT devel
)

109
install(EXPORT KF5AkonadiSearchTargets
Vishesh Handa's avatar
Vishesh Handa committed
110
111
        NAMESPACE KF5::
        DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
112
        FILE KF5AkonadiSearchTargets.cmake)
Vishesh Handa's avatar
Vishesh Handa committed
113
114
115

install(FILES
    "${CMAKE_CURRENT_BINARY_DIR}/akonadi_search_version.h"
Laurent Montel's avatar
Laurent Montel committed
116
    DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}
Vishesh Handa's avatar
Vishesh Handa committed
117
118
    COMPONENT Devel
)
Vishesh Handa's avatar
Vishesh Handa committed
119

Laurent Montel's avatar
Laurent Montel committed
120
install( FILES akonadi-search.renamecategories akonadi-search.categories DESTINATION ${KDE_INSTALL_CONFDIR} )
Laurent Montel's avatar
Laurent Montel committed
121

Vishesh Handa's avatar
Vishesh Handa committed
122
123
124
125
126
feature_summary(WHAT ALL
    INCLUDE_QUIET_PACKAGES
    FATAL_ON_MISSING_REQUIRED_PACKAGES
)