CMakeLists.txt 2.59 KB
Newer Older
1
cmake_minimum_required(VERSION 3.5)
2
set(PIM_VERSION "5.12.80")
Andreas Pakulat's avatar
Andreas Pakulat committed
3

4
project(KBlog VERSION ${PIM_VERSION})
Àlex Fiestas's avatar
Àlex Fiestas committed
5

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
6
# ECM setup
7
set(KF5_MIN_VERSION "5.63.0")
Laurent Montel's avatar
Laurent Montel committed
8

9
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
10
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
Christian Weilbach's avatar
Christian Weilbach committed
11

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

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
16
17
18
include(GenerateExportHeader)
include(ECMGenerateHeaders)
include(ECMGeneratePriFile)
19

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
20
21
include(ECMSetupVersion)
include(FeatureSummary)
22
include(ECMQtDeclareLoggingCategory)
23

Laurent Montel's avatar
Laurent Montel committed
24

Christian Weilbach's avatar
Christian Weilbach committed
25

Laurent Montel's avatar
Laurent Montel committed
26
set(KBLOG_LIB_VERSION ${PIM_VERSION})
Laurent Montel's avatar
Laurent Montel committed
27
28
set(SYNDICATION_LIB_VERSION "5.12.40")
set(XMLRPCCLIENT_LIB_VERSION "5.12.40")
29
set(QT_REQUIRED_VERSION "5.11.0")
30
ecm_setup_version(PROJECT VARIABLE_PREFIX KBLOG
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
31
32
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kblog_version.h"
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5BlogConfigVersion.cmake"
33
                        SOVERSION 5)
34

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
35
########### Find packages ###########
36
37
38
find_package(KF5CoreAddons ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
39

40
find_package(KF5CalendarCore ${KF5_MIN_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
41
42
find_package(KF5Syndication ${SYNDICATION_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5XmlRpcClient ${XMLRPCCLIENT_LIB_VERSION} CONFIG REQUIRED)
Christian Weilbach's avatar
Christian Weilbach committed
43

44
add_definitions(-DTRANSLATION_DOMAIN=\"libkblog5\")
Laurent Montel's avatar
Laurent Montel committed
45
add_definitions(-DQT_NO_FOREACH)
46
47
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
   add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
48
   add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000)
49
50
endif()

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
51
52
########### Targets ###########
add_subdirectory(src)
53
54
55
56

if(BUILD_TESTING)
    add_subdirectory(autotests)
endif()
Christian Weilbach's avatar
Christian Weilbach committed
57

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
58
########### CMake Config Files ###########
59
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Blog")
Christian Weilbach's avatar
Christian Weilbach committed
60

Laurent Montel's avatar
Laurent Montel committed
61
configure_package_config_file(
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
62
63
64
65
66
67
68
69
70
71
72
  "${CMAKE_CURRENT_SOURCE_DIR}/KF5BlogConfig.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5BlogConfig.cmake"
  INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
)

install(FILES
  "${CMAKE_CURRENT_BINARY_DIR}/KF5BlogConfig.cmake"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5BlogConfigVersion.cmake"
  DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
  COMPONENT Devel
)
Christian Weilbach's avatar
Christian Weilbach committed
73

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
74
install(EXPORT KF5BlogTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5BlogTargets.cmake NAMESPACE KF5::)
Christian Weilbach's avatar
Christian Weilbach committed
75

Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
76
77
install(FILES
   ${CMAKE_CURRENT_BINARY_DIR}/kblog_version.h
78
   DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}
Christophe Giboudeaux's avatar
Christophe Giboudeaux committed
79
80
   COMPONENT Devel
)
81
install(FILES kblog.renamecategories kblog.categories  DESTINATION  ${KDE_INSTALL_LOGGINGCATEGORIESDIR})
Christian Weilbach's avatar
Christian Weilbach committed
82

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