CMakeLists.txt 2.82 KB
Newer Older
1
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
2
set(PIM_VERSION "5.17.40")
3

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

6
set(CMAKE_CXX_STANDARD 17)
7
set(CMAKE_CXX_STANDARD_REQUIRED ON)
8

9
# ECM setup
10
set(KF5_MIN_VERSION "5.81.0")
11

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

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

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

23
24
include(ECMSetupVersion)
include(FeatureSummary)
25
include(KDEGitCommitHooks)
26
include(ECMQtDeclareLoggingCategory)
27

Laurent Montel's avatar
Laurent Montel committed
28

29
set(QT_REQUIRED_VERSION "5.15.0")
Laurent Montel's avatar
Laurent Montel committed
30
31

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

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

43
44
45
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
46
find_package(KF5Mime ${KMIME_LIBS_VERSION} CONFIG REQUIRED)
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
47

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

Laurent Montel's avatar
Laurent Montel committed
52
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050e00)
53
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055200)
54
add_definitions(-DQT_NO_EMIT)
55

56

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

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
69
endif()

70
71
########### Targets ###########
add_subdirectory(src)
72
73

if(BUILD_TESTING)
Laurent Montel's avatar
Laurent Montel committed
74
    find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Test)
75
76
77
78
    add_subdirectory(autotests)
    add_subdirectory(tests)
endif()

79
########### Install Files ###########
80
install(FILES
Christian Mollekopf's avatar
Christian Mollekopf committed
81
82
  "${CMAKE_CURRENT_BINARY_DIR}/KF5IMAPConfig.cmake"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5IMAPConfigVersion.cmake"
83
84
85
86
  DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
  COMPONENT Devel
)

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

89
90
install(FILES
   ${CMAKE_CURRENT_BINARY_DIR}/kimap_version.h
91
  DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel
92
)
93

94
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
95
ki18n_install(po)
Laurent Montel's avatar
Laurent Montel committed
96
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)