CMakeLists.txt 4.18 KB
Newer Older
1
2
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: BSD-3-Clause
3
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
4

5
set(PIM_VERSION "5.19.41")
6
project(Akonadi-Mime VERSION ${PIM_VERSION})
7
8

# ECM setup
9
set(KF5_MIN_VERSION "5.91.0")
Laurent Montel's avatar
Laurent Montel committed
10

11
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
12
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
13
set(QT_REQUIRED_VERSION "5.15.2")
14
15
16

include(KDEInstallDirs)
include(KDECMakeSettings)
17
include(KDECompilerSettings NO_POLICY_SCOPE)
18

19
include(GenerateExportHeader)
20
21
include(ECMGenerateHeaders)
include(ECMGeneratePriFile)
22

23
24
include(ECMSetupVersion)
include(FeatureSummary)
25
include(KDEGitCommitHooks)
26
27
28
29
include(KDEClangFormat)
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h *.c)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})

Laurent Montel's avatar
Laurent Montel committed
30
include(ECMQtDeclareLoggingCategory)
31
include(ECMDeprecationSettings)
Laurent Montel's avatar
Laurent Montel committed
32
33
34
35
36
include(ECMAddQch)


option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF)
add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)")
37

Laurent Montel's avatar
Laurent Montel committed
38
set(AKONADI_MIME_VERSION ${PIM_VERSION})
Laurent Montel's avatar
Laurent Montel committed
39
set(AKONADI_VERSION "5.19.41")
40
set(KF5_MIME_VERSION "5.19.40")
41

42
ecm_setup_version(PROJECT VARIABLE_PREFIX AKONADIMIME
Laurent Montel's avatar
indent    
Laurent Montel committed
43
44
45
46
    VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/akonadi-mime_version.h"
    PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiMimeConfigVersion.cmake"
    SOVERSION 5
    )
47
48

########### Find packages ###########
49
50
51
find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5XmlGui ${KF5_MIN_VERSION} CONFIG REQUIRED)
52
find_package(KF5Mime ${KF5_MIME_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
53
find_package(KF5ItemModels ${KF5_MIN_VERSION} CONFIG REQUIRED)
54

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
55
find_package(KF5Akonadi ${AKONADI_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
56

Laurent Montel's avatar
Laurent Montel committed
57
set( SharedMimeInfo_MINIMUM_VERSION "1.3" )
Laurent Montel's avatar
Laurent Montel committed
58
find_package(SharedMimeInfo ${SharedMimeInfo_MINIMUM_VERSION} REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
59

60
61
62
63
64
65
find_package(LibXslt)
set_package_properties(LibXslt PROPERTIES
    DESCRIPTION "xsltproc"
    URL "http://xmlsoft.org/XSLT/"
    TYPE REQUIRED
    PURPOSE "Needed to generate D-Bus interface specifications"
Laurent Montel's avatar
indent    
Laurent Montel committed
66
    )
67
68
69

########### Targets ###########

70
ecm_set_disabled_deprecation_versions(QT 5.15.2
71
    KF 5.92.0
72
)
73

74
option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" OFF)
75

76
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT OFF)
Laurent Montel's avatar
Laurent Montel committed
77
if (USE_UNITY_CMAKE_SUPPORT)
78
    set(COMPILE_WITH_UNITY_CMAKE_SUPPORT ON)
79
endif()
80
81
82
83
84
85
if(BUILD_TESTING)
    set(AKONADI_MIME_TEST_EXPORT AKONADI_MIME_EXPORT)
endif()
configure_file(akonadi-mimeprivate_export.h.in "${CMAKE_CURRENT_BINARY_DIR}/akonadi-mimeprivate_export.h")
include_directories(${CMAKE_CURRENT_BINARY_DIR})

86
add_subdirectory(src)
87
add_subdirectory(serializers)
88
89
90
91
92
93

if(BUILD_TESTING)
    add_subdirectory(autotests)
    add_subdirectory(tests)
endif()

94
########### CMake Config Files ###########
95
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5AkonadiMime")
96

Laurent Montel's avatar
Laurent Montel committed
97
configure_package_config_file(
Laurent Montel's avatar
indent    
Laurent Montel committed
98
99
100
101
    "${CMAKE_CURRENT_SOURCE_DIR}/KF5AkonadiMimeConfig.cmake.in"
    "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiMimeConfig.cmake"
    INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
    )
102
103

install(FILES
Laurent Montel's avatar
indent    
Laurent Montel committed
104
105
106
107
108
    "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiMimeConfig.cmake"
    "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiMimeConfigVersion.cmake"
    DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
    COMPONENT Devel
    )
109

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
110
install(EXPORT KF5AkonadiMimeTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5AkonadiMimeTargets.cmake NAMESPACE KF5::)
111
112

install(FILES
Laurent Montel's avatar
indent    
Laurent Montel committed
113
    ${CMAKE_CURRENT_BINARY_DIR}/akonadi-mime_version.h
114
    DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/AkonadiMime COMPONENT Devel
Laurent Montel's avatar
indent    
Laurent Montel committed
115
    )
116

117
ecm_qt_install_logging_categories(
Laurent Montel's avatar
Laurent Montel committed
118
119
120
121
122
        EXPORT AKONADIMIME
        FILE akonadi-mime.categories
        DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
        )

123

124
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
125
ki18n_install(po)
Laurent Montel's avatar
Laurent Montel committed
126
127
128
129
130
131
132
133
134
135
136

if (BUILD_QCH)
    ecm_install_qch_export(
        TARGETS KF5AkonadiMime_QCH
        FILE KF5AkonadiMimeQchTargets.cmake
        DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
        COMPONENT Devel
    )
    set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF5AkonadiMimeQchTargets.cmake\")")
endif()

137
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)