CMakeLists.txt 2.7 KB
Newer Older
1
cmake_minimum_required(VERSION 3.5)
2

3
set(KF5_MIN_VERSION "5.70.0")
Laurent Montel's avatar
Laurent Montel committed
4
set(PIM_VERSION "5.14.40")
5
6
7

project(GrantleeTheme VERSION ${PIM_VERSION})

8

9
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
Laurent Montel's avatar
Laurent Montel committed
10
set(CMAKE_MODULE_PATH ${GrantleeTheme_SOURCE_DIR}/cmake ${ECM_MODULE_PATH})
11
set(LIBRARY_NAMELINK)
12
13
14
15
16

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

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

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

Laurent Montel's avatar
Laurent Montel committed
26
include(KPIMGrantleeMacros)
27

Laurent Montel's avatar
Laurent Montel committed
28
29
30
31
if (POLICY CMP0053)
    cmake_policy(SET CMP0053 NEW)
endif()

Laurent Montel's avatar
Laurent Montel committed
32
33
set(GRANTLEETHEME_LIB_VERSION ${PIM_VERSION})

34
set(QT_REQUIRED_VERSION "5.12.0")
Laurent Montel's avatar
Laurent Montel committed
35
set(GRANTLEE_VERSION "5.1")
36

37
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Network)
38
find_package(KF5GuiAddons ${KF5_MIN_VERSION} CONFIG REQUIRED)
39
40
41
find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5IconThemes ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5NewStuff ${KF5_MIN_VERSION} CONFIG REQUIRED)
42
43
44

find_package(Grantlee5 ${GRANTLEE_VERSION} CONFIG REQUIRED)

45
ecm_setup_version(PROJECT VARIABLE_PREFIX GRANTLEETHEME
46
47
48
49
50
51
52
                        VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/grantleetheme_version.h"
                        PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5GrantleeThemeConfigVersion.cmake"
                        SOVERSION 5
)

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

53
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
54
   add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050e00)
55
   add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054600)
56
57
endif()

Laurent Montel's avatar
Laurent Montel committed
58
add_definitions(-DQT_NO_FOREACH)
59
add_definitions(-DQT_NO_KEYWORDS)
60

61
62
63
64

########### CMake Config Files ###########
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5GrantleeTheme")

65
configure_package_config_file(
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
  "${CMAKE_CURRENT_SOURCE_DIR}/KF5GrantleeThemeConfig.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/KF5GrantleeThemeConfig.cmake"
  INSTALL_DESTINATION  ${CMAKECONFIG_INSTALL_DIR}
)

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

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

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


add_subdirectory(src)
if (BUILD_TESTING)
88
    find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Test)
89
90
91
   add_subdirectory(autotest)
endif()

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