forked from KDE/kirigami
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
118 lines (85 loc) · 3.86 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
cmake_minimum_required(VERSION 3.0)
set(KF5_VERSION "5.36.0") # handled by release scripts
set(KF5_DEP_VERSION "5.35.0") # handled by release scripts
project(kirigami2 VERSION ${KF5_VERSION})
set(REQUIRED_QT_VERSION "5.7.0")
################# Disallow in-source build #################
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "kirigami requires an out of source build. Please create a separate build directory and run 'cmake path_to_kirigami [options]' there.")
endif()
option(PLASMA_ENABLED "Build and install The Plasma style" ON)
option(DESKTOP_ENABLED "Build and install The Desktop style" ON)
option(STATIC_LIBRARY "Build as a static library" OFF)
option(BUILD_EXAMPLES "Build and install examples" OFF)
# Make CPack available to easy generate binary packages
include(CPack)
include(FeatureSummary)
IF(STATIC_LIBRARY)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
ADD_DEFINITIONS(-DKIRIGAMI_BUILD_TYPE_STATIC)
find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Svg)
add_subdirectory(src)
ELSE(STATIC_LIBRARY)
################# set KDE specific information #################
find_package(ECM 5.35.0 NO_MODULE)
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules")
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(CMakePackageConfigHelpers)
include(ECMPoQmTools)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Kirigami2")
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/KF5Kirigami2Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/KF5Kirigami2Config.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
PATH_VARS KF5_INCLUDE_INSTALL_DIR CMAKE_INSTALL_PREFIX
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/KF5Kirigami2Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/KF5Kirigami2ConfigVersion.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/KF5Kirigami2Macros.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
ecm_setup_version(${KF5_VERSION}
VARIABLE_PREFIX KIRIGAMI
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kirigami_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5Kirigami2ConfigVersion.cmake"
SOVERSION 5)
find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Svg QuickControls2)
if(BUILD_EXAMPLES AND CMAKE_SYSTEM_NAME STREQUAL "Android")
# treat plasma as an optinal dep: full functionality is expected with only Qt
find_package(Qt5AndroidExtras ${REQUIRED_QT_VERSION} REQUIRED)
endif()
if(PLASMA_ENABLED)
# treat plasma as an optional dep: full functionality is expected with only Qt
find_package(KF5Plasma ${KF5_DEP_VERSION})
set_package_properties(KF5Plasma PROPERTIES DESCRIPTION "Plasma framework"
TYPE OPTIONAL
PURPOSE "Optional Look and feel integration with Plasma Mobile."
)
endif()
################# Enable C++11 features for clang and gcc #################
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++0x")
endif()
################# now find all used packages #################
find_package(PkgConfig)
#########################################################################
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_subdirectory(autotests)
add_subdirectory(src)
if (BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
ENDIF(STATIC_LIBRARY)
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po")
ecm_install_po_files_as_qm(po)
endif()
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)