CMakeLists.txt 2.6 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(gravatar VERSION ${PIM_VERSION})
5

6
set(KF5_MIN_VERSION "5.73.0")
7

8
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
9
10
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
set(LIBRARY_NAMELINK)
11
12
13
14
15

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

16
17
18
19
include(GenerateExportHeader)
include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(ECMGeneratePriFile)
20

21
22
23
include(FeatureSummary)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
24

Laurent Montel's avatar
Laurent Montel committed
25

26

27
set(QT_REQUIRED_VERSION "5.13.0")
Laurent Montel's avatar
Laurent Montel committed
28
set(LIBGRAVATAR_LIB_VERSION ${PIM_VERSION})
29
set(PIMCOMMON_LIB_VERSION "5.15.40")
30
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Test Network)
31
32
33
34
35
find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Config ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5WidgetsAddons ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5TextWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
36
find_package(KF5PimCommon ${PIMCOMMON_LIB_VERSION} CONFIG REQUIRED)
37

38
ecm_setup_version(PROJECT VARIABLE_PREFIX GRAVATAR
Laurent Montel's avatar
indent    
Laurent Montel committed
39
40
41
42
    VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/gravatar_version.h"
    PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5GravatarConfigVersion.cmake"
    SOVERSION 5
    )
43
44
45
46


########### Targets ###########

47

48
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
49
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054900)
50

Laurent Montel's avatar
Laurent Montel committed
51
add_definitions(-DQT_NO_FOREACH)
52
add_definitions(-DQT_NO_KEYWORDS)
53
54
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Laurent Montel's avatar
Laurent Montel committed
55

56
57
58
########### CMake Config Files ###########
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Gravatar")

Laurent Montel's avatar
Laurent Montel committed
59
configure_package_config_file(
Laurent Montel's avatar
indent    
Laurent Montel committed
60
61
62
63
    "${CMAKE_CURRENT_SOURCE_DIR}/KF5GravatarConfig.cmake.in"
    "${CMAKE_CURRENT_BINARY_DIR}/KF5GravatarConfig.cmake"
    INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
    )
64
65

install(FILES
Laurent Montel's avatar
indent    
Laurent Montel committed
66
67
68
69
70
    "${CMAKE_CURRENT_BINARY_DIR}/KF5GravatarConfig.cmake"
    "${CMAKE_CURRENT_BINARY_DIR}/KF5GravatarConfigVersion.cmake"
    DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
    COMPONENT Devel
    )
71
72
73
74

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

install(FILES
Laurent Montel's avatar
indent    
Laurent Montel committed
75
76
77
    ${CMAKE_CURRENT_BINARY_DIR}/gravatar_version.h
    DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel
    )
78
79
if(BUILD_TESTING)
   add_definitions(-DBUILD_TESTING)
Laurent Montel's avatar
Laurent Montel committed
80
endif()
81
82
83

add_subdirectory(src)
if (BUILD_TESTING)
Laurent Montel's avatar
indent    
Laurent Montel committed
84
85
    add_subdirectory(autotests)
    add_subdirectory(tests)
86
87
endif()

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