CMakeLists.txt 3.57 KB
Newer Older
1
cmake_minimum_required(VERSION 3.5)
2

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

# ECM setup
7
set(KF5_MIN_VERSION "5.67.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.12.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)
Laurent Montel's avatar
Laurent Montel committed
23
include(ECMQtDeclareLoggingCategory)
24

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

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

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

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

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

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

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

59
60
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
   add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
61
   add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000)
62
63
endif()

Laurent Montel's avatar
Laurent Montel committed
64
add_definitions(-DQT_NO_FOREACH)
65

66
67
68
69
70
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})
71
option(NO_REGENERATE_MIME "Don't regenerate mime file (only for developper)" FALSE )
72

73
add_subdirectory(src)
74
add_subdirectory(serializers)
75
76
77
78
79
80

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

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

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

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

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

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

Laurent Montel's avatar
Laurent Montel committed
104
105
106
107
108
109
110
111
112
113
if (ECM_VERSION VERSION_LESS "5.68.0")
    install(FILES akonadi-mime.categories  DESTINATION  ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
else ()
    ecm_qt_install_logging_categories(
        EXPORT AKONADIMIME
        FILE akonadi-mime.categories
        DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
        )
endif()

114

115
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)