CMakeLists.txt 2.73 KB
Newer Older
1
cmake_minimum_required(VERSION 3.5)
Laurent Montel's avatar
Laurent Montel committed
2
set(PIM_VERSION "5.16.40")
Gregory Schlomoff's avatar
Gregory Schlomoff committed
3

4
project(KSMTP VERSION ${PIM_VERSION})
Gregory Schlomoff's avatar
Gregory Schlomoff committed
5

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

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

12
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
13 14
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})

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

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

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

Gregory Schlomoff's avatar
Gregory Schlomoff committed
27 28


29
set(KSMTP_LIB_VERSION ${PIM_VERSION})
30
set(QT_REQUIRED_VERSION "5.13.0")
31 32 33 34 35 36 37 38
ecm_setup_version(PROJECT VARIABLE_PREFIX KSMTP
    VERSION_HEADER ${KSMTP_BINARY_DIR}/ksmtp_version.h
    PACKAGE_VERSION_FILE ${KSMTP_BINARY_DIR}/KPimSMTPConfigVersion.cmake
    SOVERSION 5
)


############ Find packages ############
Daniel Vrátil's avatar
Daniel Vrátil committed
39 40
find_package(Qt5Network ${QT_REQUIRED_VERSION} 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)
Daniel Vrátil's avatar
Daniel Vrátil committed
44

45
find_package(Sasl2)
46
set_package_properties(Sasl2 PROPERTIES TYPE REQUIRED)
47

48 49
########### CMake Config Files ############
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KPimSMTP")
Gregory Schlomoff's avatar
Gregory Schlomoff committed
50

51 52 53 54
configure_package_config_file(
    "${KSMTP_SOURCE_DIR}/KPimSMTPConfig.cmake.in"
    "${KSMTP_BINARY_DIR}/KPimSMTPConfig.cmake"
    INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
Gregory Schlomoff's avatar
Gregory Schlomoff committed
55 56
)

Laurent Montel's avatar
Laurent Montel committed
57
add_definitions(-DTRANSLATION_DOMAIN=\"libksmtp5\")
58
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
59
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054E00)
60

61
add_definitions(-DQT_NO_FOREACH)
62
add_definitions(-DQT_NO_KEYWORDS)
63

64 65 66 67 68 69 70 71 72 73
option(USE_UNIFY_CMAKE_SUPPORT "Use UNIFY cmake support (speedup compile time)" FALSE)

set(COMPILE_WITH_CMAKE_SUPPORT false)
if (USE_UNIFY_CMAKE_SUPPORT)
    if(${CMAKE_VERSION} VERSION_LESS "3.16.0")
        message(STATUS "CMAKE version is less than 3.16.0 . We can't use cmake unify build support")
    else()
        set(COMPILE_WITH_CMAKE_SUPPORT true)
    endif()
endif()
Laurent Montel's avatar
Laurent Montel committed
74

75 76 77 78 79
########### Targets ###########
add_subdirectory(src)

if (BUILD_TESTING)
    add_subdirectory(autotests)
80
    add_subdirectory(tests)
81 82 83 84 85 86 87 88
endif ()

########### Install Files ############
install(FILES
    "${KSMTP_BINARY_DIR}/KPimSMTPConfig.cmake"
    "${KSMTP_BINARY_DIR}/KPimSMTPConfigVersion.cmake"
    DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
    COMPONENT Devel
Gregory Schlomoff's avatar
Gregory Schlomoff committed
89 90
)

91
install(EXPORT KPimSMTPTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KPimSMTPTargets.cmake NAMESPACE KPim::)
Gregory Schlomoff's avatar
Gregory Schlomoff committed
92

93 94 95 96
install(FILES
    ${KSMTP_BINARY_DIR}/ksmtp_version.h
    DESTINATION ${KDE_INSTALL_INCLUDEDIR}/KPim COMPONENT Devel
)
Gregory Schlomoff's avatar
Gregory Schlomoff committed
97

98
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)