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

3
set(KF5_MIN_VERSION "5.77.0")
Laurent Montel's avatar
Laurent Montel committed
4
set(PIM_VERSION "5.16.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
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
include(KPIMGrantleeMacros)
26

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

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

33
set(QT_REQUIRED_VERSION "5.14.0")
34
set(GRANTLEE_VERSION "5.2")
35

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

find_package(Grantlee5 ${GRANTLEE_VERSION} CONFIG REQUIRED)

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

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

52
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
53
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054E00)
54

Laurent Montel's avatar
Laurent Montel committed
55
add_definitions(-DQT_NO_FOREACH)
56
add_definitions(-DQT_NO_KEYWORDS)
57
58
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
59

60
61
62
63
64
65
66
67
68
69
option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" FALSE)

set(COMPILE_WITH_UNITY_CMAKE_SUPPORT false)
if (USE_UNITY_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_UNITY_CMAKE_SUPPORT true)
    endif()
endif()
70
71
72
########### CMake Config Files ###########
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5GrantleeTheme")

73
configure_package_config_file(
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
  "${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)
96
    find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Test)
97
98
99
   add_subdirectory(autotest)
endif()

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