CMakeLists.txt 3.51 KB
Newer Older
1
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
2

3
set(PIM_VERSION "5.17.40")
4
project(Akonadi-Mime VERSION ${PIM_VERSION})
5
6

# ECM setup
7
set(KF5_MIN_VERSION "5.81.0")
Laurent Montel's avatar
Laurent Montel committed
8

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

include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)

17
include(GenerateExportHeader)
18
19
include(ECMGenerateHeaders)
include(ECMGeneratePriFile)
20

21
22
include(ECMSetupVersion)
include(FeatureSummary)
23
include(KDEGitCommitHooks)
Laurent Montel's avatar
Laurent Montel committed
24
include(ECMQtDeclareLoggingCategory)
25

Laurent Montel's avatar
Laurent Montel committed
26
set(AKONADI_MIME_VERSION ${PIM_VERSION})
27
28
set(AKONADI_VERSION "5.17.40")
set(KF5_MIME_VERSION "5.17.40")
29

30
ecm_setup_version(PROJECT VARIABLE_PREFIX AKONADIMIME
Laurent Montel's avatar
indent    
Laurent Montel committed
31
32
33
34
    VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/akonadi-mime_version.h"
    PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiMimeConfigVersion.cmake"
    SOVERSION 5
    )
35
36

########### Find packages ###########
37
38
39
find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5XmlGui ${KF5_MIN_VERSION} CONFIG REQUIRED)
40
find_package(KF5Mime ${KF5_MIME_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
41
find_package(KF5ItemModels ${KF5_MIN_VERSION} CONFIG REQUIRED)
42

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

Laurent Montel's avatar
Laurent Montel committed
45
set( SharedMimeInfo_MINIMUM_VERSION "1.3" )
Laurent Montel's avatar
Laurent Montel committed
46
find_package(SharedMimeInfo ${SharedMimeInfo_MINIMUM_VERSION} REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
47

48
49
50
51
52
53
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
54
    )
55
56
57

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

58
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
59
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055200)
60

61
set(CMAKE_CXX_STANDARD 17)
62
set(CMAKE_CXX_STANDARD_REQUIRED ON)
63
option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" OFF)
64

65
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT OFF)
Laurent Montel's avatar
Laurent Montel committed
66
if (USE_UNITY_CMAKE_SUPPORT)
67
    set(COMPILE_WITH_UNITY_CMAKE_SUPPORT ON)
68
endif()
69
70
71
72
73
74
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})

75
add_subdirectory(src)
76
add_subdirectory(serializers)
77
78
79
80
81
82

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

83
########### CMake Config Files ###########
84
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5AkonadiMime")
85

Laurent Montel's avatar
Laurent Montel committed
86
configure_package_config_file(
Laurent Montel's avatar
indent    
Laurent Montel committed
87
88
89
90
    "${CMAKE_CURRENT_SOURCE_DIR}/KF5AkonadiMimeConfig.cmake.in"
    "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiMimeConfig.cmake"
    INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
    )
91
92

install(FILES
Laurent Montel's avatar
indent    
Laurent Montel committed
93
94
95
96
97
    "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiMimeConfig.cmake"
    "${CMAKE_CURRENT_BINARY_DIR}/KF5AkonadiMimeConfigVersion.cmake"
    DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
    COMPONENT Devel
    )
98

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
99
install(EXPORT KF5AkonadiMimeTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5AkonadiMimeTargets.cmake NAMESPACE KF5::)
100
101

install(FILES
Laurent Montel's avatar
indent    
Laurent Montel committed
102
103
104
    ${CMAKE_CURRENT_BINARY_DIR}/akonadi-mime_version.h
    DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel
    )
105

106
ecm_qt_install_logging_categories(
Laurent Montel's avatar
Laurent Montel committed
107
108
109
110
111
        EXPORT AKONADIMIME
        FILE akonadi-mime.categories
        DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
        )

112

113
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
114
ki18n_install(po)
115
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)