CMakeLists.txt 4.22 KB
Newer Older
1
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
Laurent Montel's avatar
Laurent Montel committed
2
set(PIM_VERSION "5.18.1")
3

Laurent Montel's avatar
Laurent Montel committed
4
project(libkleo VERSION ${PIM_VERSION})
5

6
set(KF5_MIN_VERSION "5.83.0")
Laurent Montel's avatar
Laurent Montel committed
7

8
9
10
11
12
13
14
if (WIN32)
  set(KF5_WANT_VERSION "5.70.0")
else ()
  set(KF5_WANT_VERSION ${KF5_MIN_VERSION})
endif ()

find_package(ECM ${KF5_WANT_VERSION} CONFIG REQUIRED)
15
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
16
17
18
19
20

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

21
22
23
24
include(GenerateExportHeader)
include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(ECMGeneratePriFile)
25

26
27
28
include(FeatureSummary)
include(ECMQtDeclareLoggingCategory)

Laurent Montel's avatar
Laurent Montel committed
29
set(LIBKLEO_LIB_VERSION ${PIM_VERSION})
30
set(QT_REQUIRED_VERSION "5.15.0")
Laurent Montel's avatar
Laurent Montel committed
31
set(KDEPIMTEXTEDIT_VERSION "5.18.1")
32

Andre Heinecke's avatar
Andre Heinecke committed
33
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets)
34
35
36
37
38
39
40
find_package(KF5I18n ${KF5_WANT_VERSION} CONFIG REQUIRED)
find_package(KF5Config ${KF5_WANT_VERSION} CONFIG REQUIRED)
find_package(KF5WidgetsAddons ${KF5_WANT_VERSION} CONFIG REQUIRED)
find_package(KF5Completion ${KF5_WANT_VERSION} CONFIG REQUIRED)
find_package(KF5CoreAddons ${KF5_WANT_VERSION} CONFIG REQUIRED)
find_package(KF5Codecs ${KF5_WANT_VERSION} CONFIG REQUIRED)
find_package(KF5ItemModels ${KF5_WANT_VERSION} CONFIG REQUIRED)
41
find_package(KF5PimTextEdit ${KDEPIMTEXTEDIT_VERSION} CONFIG)
Laurent Montel's avatar
Laurent Montel committed
42

43
set(GPGMEPP_LIB_VERSION "1.13.1")
44
find_package(Gpgmepp ${GPGMEPP_LIB_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
45
set_package_properties(Gpgmepp PROPERTIES DESCRIPTION "GpgME++ Library" URL "https://www.gnupg.org" TYPE REQUIRED PURPOSE "GpgME++ is required for OpenPGP support")
Laurent Montel's avatar
Laurent Montel committed
46
find_package(QGpgme ${GPGMEPP_LIB_VERSION} CONFIG REQUIRED)
47
message(STATUS "GPGME Version ${Gpgmepp_VERSION}")
48
if (Gpgmepp_VERSION VERSION_GREATER_EQUAL "1.16.0")
49
50
    set(GPGMEPP_SUPPORTS_TRUST_SIGNATURES 1)
endif()
51

Laurent Montel's avatar
Laurent Montel committed
52
find_package(Boost 1.34.0)
Laurent Montel's avatar
Laurent Montel committed
53
set_package_properties(Boost PROPERTIES DESCRIPTION "Boost C++ Libraries" URL "https://www.boost.org" TYPE REQUIRED PURPOSE "Boost is required for building most KDEPIM applications")
Laurent Montel's avatar
Laurent Montel committed
54
55


56
57
set_package_properties(KF5PimTextEdit PROPERTIES DESCRIPTION
                       "A textedit with PIM-specific features."
58
                       URL "https://commits.kde.org/kpimtextedit"
59
60
                       TYPE OPTIONAL PURPOSE "Improved audit log viewer.")

Laurent Montel's avatar
Laurent Montel committed
61
ecm_setup_version(PROJECT VARIABLE_PREFIX LIBKLEO
62
63
64
65
66
67
68
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/libkleo_version.h"
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5LibkleoConfigVersion.cmake"
                        SOVERSION 5
)

########### Targets ###########
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0)
69
#add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
70
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055400)
71
remove_definitions(-DQT_NO_FOREACH)
72
add_definitions(-DQT_NO_EMIT)
73
set(CMAKE_CXX_STANDARD 17)
74
set(CMAKE_CXX_STANDARD_REQUIRED ON)
75
76
77
########### CMake Config Files ###########
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Libkleo")

78
configure_package_config_file(
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
  "${CMAKE_CURRENT_SOURCE_DIR}/KF5LibkleoConfig.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5LibkleoConfig.cmake"
  INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
)

install(FILES
  "${CMAKE_CURRENT_BINARY_DIR}/KF5LibkleoConfig.cmake"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5LibkleoConfigVersion.cmake"
  DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
  COMPONENT Devel
)

install(EXPORT KF5LibkleoTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5LibkleoTargets.cmake NAMESPACE KF5::)

install(FILES
   ${CMAKE_CURRENT_BINARY_DIR}/libkleo_version.h
  DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel
)

98
99
100
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-libkleo.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-libkleo.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

101
option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" OFF)
102

103
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT OFF)
Laurent Montel's avatar
Laurent Montel committed
104
if (USE_UNITY_CMAKE_SUPPORT)
105
    set(COMPILE_WITH_UNITY_CMAKE_SUPPORT ON)
106
endif()
Laurent Montel's avatar
Laurent Montel committed
107

108
109

add_subdirectory(src)
110
111
112
113
if (BUILD_TESTING)
    add_subdirectory(autotests)
endif()

114
ecm_qt_install_logging_categories(
Laurent Montel's avatar
Laurent Montel committed
115
116
117
118
        EXPORT LIBKLEO
        FILE libkleo.categories
        DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
        )
119
ki18n_install(po)
Laurent Montel's avatar
Laurent Montel committed
120
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)