CMakeLists.txt 2.59 KB
Newer Older
1
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
2
set(PIM_VERSION "5.17.40")
Allen Winter's avatar
Allen Winter committed
3

4
project(KTnef VERSION ${PIM_VERSION})
Volker Krause's avatar
Volker Krause committed
5

6
set(KF5_MIN_VERSION "5.81.0")
7

8
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
9
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
10

11
12
13
14
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)

Laurent Montel's avatar
Laurent Montel committed
15
16
17
include(GenerateExportHeader)
include(ECMGenerateHeaders)
include(ECMGeneratePriFile)
18

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

Laurent Montel's avatar
Laurent Montel committed
24

25

26

Laurent Montel's avatar
Laurent Montel committed
27
set(KTNEF_LIB_VERSION ${PIM_VERSION})
28
set(CALENDARUTILS_LIB_VERSION "5.17.40")
29
set(QT_REQUIRED_VERSION "5.15.0")
30
ecm_setup_version(PROJECT VARIABLE_PREFIX KTNEF
Laurent Montel's avatar
Laurent Montel committed
31
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/ktnef_version.h"
32
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5TnefConfigVersion.cmake"
Laurent Montel's avatar
Laurent Montel committed
33
                        SOVERSION 5
34
)
35

Laurent Montel's avatar
Laurent Montel committed
36
########### Find packages ###########
37
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Tnef")
Laurent Montel's avatar
Laurent Montel committed
38

39
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets)
40
find_package(KF5CalendarCore ${KF5_MIN_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
41
find_package(KF5CalendarUtils ${CALENDARUTILS_LIB_VERSION} CONFIG REQUIRED)
42
find_package(KF5Contacts ${KF5_MIN_VERSION} CONFIG REQUIRED)
43
find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED)
Allen Winter's avatar
cleanup    
Allen Winter committed
44

45
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
46
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055200)
47

48
set(CMAKE_CXX_STANDARD 17)
49
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Laurent Montel's avatar
Laurent Montel committed
50

Laurent Montel's avatar
Laurent Montel committed
51
configure_package_config_file(
52
53
  "${KTnef_SOURCE_DIR}/KF5TnefConfig.cmake.in"
  "${KTnef_BINARY_DIR}/KF5TnefConfig.cmake"
Laurent Montel's avatar
Laurent Montel committed
54
55
56
57
  INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
)

install(FILES
58
59
  "${KTnef_BINARY_DIR}/KF5TnefConfig.cmake"
  "${KTnef_BINARY_DIR}/KF5TnefConfigVersion.cmake"
Laurent Montel's avatar
Laurent Montel committed
60
61
62
63
  DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
  COMPONENT Devel
)

64
install(EXPORT KF5TnefTargets
65
        DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
66
        FILE KF5TnefTargets.cmake
67
68
69
        NAMESPACE KF5::
)

Laurent Montel's avatar
Laurent Montel committed
70
71
install(FILES
   ${CMAKE_CURRENT_BINARY_DIR}/ktnef_version.h
72
   DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}
Laurent Montel's avatar
Laurent Montel committed
73
74
75
   COMPONENT Devel
)

Laurent Montel's avatar
Laurent Montel committed
76

77
add_definitions(-DTRANSLATION_DOMAIN=\"libktnef5\")
78
option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" OFF)
79

80
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT OFF)
81
if (USE_UNITY_CMAKE_SUPPORT)
82
    set(COMPILE_WITH_UNITY_CMAKE_SUPPORT ON)
83
endif()
Laurent Montel's avatar
Laurent Montel committed
84
add_subdirectory(src)
85
86
87
88
89

if(BUILD_TESTING)
    add_subdirectory(autotests)
endif()

90
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
91
ki18n_install(po)
Laurent Montel's avatar
Laurent Montel committed
92
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)