CMakeLists.txt 2.64 KB
Newer Older
1
cmake_minimum_required(VERSION 3.5)
2
set(PIM_VERSION "5.13.40")
3

4
project(KIMAP VERSION ${PIM_VERSION})
Àlex Fiestas's avatar
Àlex Fiestas committed
5

6
7
set(CMAKE_CXX_STANDARD 14)

8
# ECM setup
9
set(KF5_MIN_VERSION "5.67.0")
10

11
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
12
13
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})

14
15
16
17
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)

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

22
23
include(ECMSetupVersion)
include(FeatureSummary)
24
include(ECMQtDeclareLoggingCategory)
25

Laurent Montel's avatar
Laurent Montel committed
26

27
set(QT_REQUIRED_VERSION "5.12.0")
Laurent Montel's avatar
Laurent Montel committed
28
29

set(KIMAP_LIB_VERSION ${PIM_VERSION})
Laurent Montel's avatar
Laurent Montel committed
30
set(KMIME_LIBS_VERSION "5.13.40")
31
ecm_setup_version(PROJECT VARIABLE_PREFIX KIMAP
32
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kimap_version.h"
Christian Mollekopf's avatar
Christian Mollekopf committed
33
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5IMAPConfigVersion.cmake"
34
                        SOVERSION 5
35
)
36

37
########### Find packages ###########
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
38
39
40
find_package(Sasl2)
set_package_properties(Sasl2 PROPERTIES TYPE REQUIRED)

41
42
43
find_package(KF5CoreAddons ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
44
find_package(KF5Mime ${KMIME_LIBS_VERSION} CONFIG REQUIRED)
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
45

46
########### CMake Config Files ###########
Christian Mollekopf's avatar
Christian Mollekopf committed
47
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5IMAP")
48
add_definitions(-DTRANSLATION_DOMAIN=\"libkimap5\")
49

50
51
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
   add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
52
   add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000)
53
54
endif()

55

Laurent Montel's avatar
Laurent Montel committed
56
configure_package_config_file(
Christian Mollekopf's avatar
Christian Mollekopf committed
57
58
  "${CMAKE_CURRENT_SOURCE_DIR}/KF5IMAPConfig.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5IMAPConfig.cmake"
59
  INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
60
)
61

62
63
########### Targets ###########
add_subdirectory(src)
64
65

if(BUILD_TESTING)
Laurent Montel's avatar
Laurent Montel committed
66
    find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Test)
67
68
69
70
    add_subdirectory(autotests)
    add_subdirectory(tests)
endif()

71
########### Install Files ###########
72
install(FILES
Christian Mollekopf's avatar
Christian Mollekopf committed
73
74
  "${CMAKE_CURRENT_BINARY_DIR}/KF5IMAPConfig.cmake"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5IMAPConfigVersion.cmake"
75
76
77
78
  DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
  COMPONENT Devel
)

Christian Mollekopf's avatar
Christian Mollekopf committed
79
install(EXPORT KF5IMAPTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5IMAPTargets.cmake NAMESPACE KF5::)
80

81
82
install(FILES
   ${CMAKE_CURRENT_BINARY_DIR}/kimap_version.h
83
  DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel
84
)
85

Laurent Montel's avatar
Laurent Montel committed
86
87
88
if (ECM_VERSION VERSION_LESS "5.68.0")
    install(FILES kimap.categories  kimap.renamecategories DESTINATION  ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
endif()
Laurent Montel's avatar
Laurent Montel committed
89
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)