CMakeLists.txt 2.27 KB
Newer Older
1
cmake_minimum_required(VERSION 3.5)
Laurent Montel's avatar
Laurent Montel committed
2
set(PIM_VERSION "5.15.40")
3

4
project(KMime VERSION ${PIM_VERSION})
5 6

# ECM setup
Laurent Montel's avatar
Laurent Montel committed
7
set(KF5_MIN_VERSION "5.74.0")
8

9
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
KUrl--  
Laurent Montel committed
10
set(CMAKE_MODULE_PATH ${KMime_SOURCE_DIR}/cmake ${ECM_MODULE_PATH})
11

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

16
include(GenerateExportHeader)
17
include(ECMGeneratePriFile)
18

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

24

Laurent Montel's avatar
Laurent Montel committed
25
set(KMIME_LIB_VERSION ${PIM_VERSION})
26
set(QT_REQUIRED_VERSION "5.13.0")
Laurent Montel's avatar
Laurent Montel committed
27
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Core)
28

29
ecm_setup_version(PROJECT VARIABLE_PREFIX KMIME
30
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kmime_version.h"
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
31
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5MimeConfigVersion.cmake"
32 33 34 35
                        SOVERSION 5
)

########### Find packages ###########
36 37
find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Codecs ${KF5_MIN_VERSION} CONFIG REQUIRED)
38
add_definitions(-DTRANSLATION_DOMAIN=\"libkmime5\")
39
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
40
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054A00)
41 42
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
43 44 45

########### Targets ###########
add_subdirectory(src)
46
add_subdirectory(includes)
47 48 49 50 51

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

########### CMake Config Files ###########
54
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Mime")
55

Laurent Montel's avatar
Laurent Montel committed
56
configure_package_config_file(
Marko Käning's avatar
Marko Käning committed
57 58 59 60
    "${KMime_SOURCE_DIR}/KF5MimeConfig.cmake.in"
    "${KMime_BINARY_DIR}/KF5MimeConfig.cmake"
    INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
    )
61 62

install(FILES
Marko Käning's avatar
Marko Käning committed
63 64 65 66 67
    "${KMime_BINARY_DIR}/KF5MimeConfig.cmake"
    "${KMime_BINARY_DIR}/KF5MimeConfigVersion.cmake"
    DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
    COMPONENT Devel
    )
68

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
69
install(EXPORT KF5MimeTargets
Marko Käning's avatar
Marko Käning committed
70 71 72 73
    DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
    FILE KF5MimeTargets.cmake
    NAMESPACE KF5::
    )
74 75

install(FILES
Marko Käning's avatar
Marko Käning committed
76 77 78 79
    ${KMime_BINARY_DIR}/kmime_version.h
    DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}
    COMPONENT Devel
    )
80

Laurent Montel's avatar
Laurent Montel committed
81
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)