forked from KDE/kommit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
174 lines (136 loc) · 4.61 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
cmake_minimum_required(VERSION 3.16)
project(kommit)
set(PROJECT_VERSION_MAJOR 1)
set(PROJECT_VERSION_MINOR 6)
set(PROJECT_VERSION_PATCH 42)
set(RELEASE_SERVICE_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
set(LIBKOMMIT_LIB_VERSION "${RELEASE_SERVICE_VERSION}")
set(LIBKOMMIT_LIB_SOVERSION "0")
set(QT_MIN_VERSION 5.15.2)
set(KF_MIN_VERSION 5.90.0)
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
add_definitions(-DGK_VERSION="${RELEASE_SERVICE_VERSION}")
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBGIT2 "libgit2>=1.0" REQUIRED IMPORTED_TARGET)
find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(KDEInstallDirs)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(KDECMakeSettings NO_POLICY_SCOPE)
include(FeatureSummary)
include(ECMInstallIcons)
include(ECMQtDeclareLoggingCategory)
include(ECMAddAppIcon)
include(ECMSetupVersion)
include(ECMAddTests)
include(GenerateExportHeader)
include(KDEGitCommitHooks)
include(KDEClangFormat)
include(ECMDeprecationSettings)
if(QT_MAJOR_VERSION STREQUAL "6")
set(QT_MIN_VERSION "6.4.0")
set(KF_MIN_VERSION "6.3.0")
set(KF_MAJOR_VERSION "6")
else()
set(KF_MAJOR_VERSION "5")
endif()
set(CMAKE_CXX_STANDARD 17)
find_package(
Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION}
CONFIG REQUIRED
Core
Gui
Widgets
Concurrent
)
find_package(
Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION}
QUIET CONFIG OPTIONAL_COMPONENTS
Charts
)
find_package(
KF${KF_MAJOR_VERSION} ${KF_MIN_VERSION}
REQUIRED COMPONENTS
ConfigWidgets
CoreAddons
Crash
DocTools
I18n
XmlGui
KIO
TextWidgets
TextEditor
SyntaxHighlighting
)
if(NOT WIN32 AND NOT APPLE AND NOT HAIKU)
find_package(KF${KF_MAJOR_VERSION}DBusAddons ${KF_MIN_VERSION} CONFIG REQUIRED)
set(HAVE_KDBUSADDONS true)
endif()
find_package(DolphinVcs)
set_package_properties(DolphinVcs PROPERTIES
TYPE OPTIONAL
PURPOSE "Required for building dolphin plugins"
DESCRIPTION "Use for building dolphin plugin"
)
add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
add_definitions(-DQT_NO_CAST_TO_ASCII)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
add_definitions(-DQT_NO_FOREACH)
add_definitions(-DQT_NO_CONTEXTLESS_CONNECT)
#add_definitions(-DQT_NO_CAST_FROM_ASCII)
configure_file(config-kommit.h.in ${CMAKE_CURRENT_BINARY_DIR}/config-kommit.h)
ecm_set_disabled_deprecation_versions(QT 5.15.2 KF 6.5)
option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" OFF)
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT OFF)
if(USE_UNITY_CMAKE_SUPPORT)
set(COMPILE_WITH_UNITY_CMAKE_SUPPORT ON)
endif()
if(BUILD_TESTING)
find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Test)
add_definitions(-DBUILD_TESTING)
endif()
kdoctools_install(po)
add_subdirectory(icons)
add_subdirectory(src)
if(UNIX AND TARGET DolphinVcs)
add_subdirectory(dolphinplugins)
endif()
ecm_qt_install_logging_categories(
EXPORT KOMMIT
FILE kommit.categories
DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}
)
if(KOMMIT_BUILD_DIR)
file(WRITE ${KOMMIT_BUILD_DIR}/version "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
message("-- Version in file ${KOMMIT_BUILD_DIR}/version saved")
endif()
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
ki18n_install(po)
#CPack
set(CPACK_PACKAGE_NAME ${PROJECT_NAME}
CACHE STRING "The resulting package name"
)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "KDE git gui client"
CACHE STRING "Package description for the package metadata"
)
set(CPACK_PACKAGE_VENDOR "KDE")
set(CPACK_VERBATIM_VARIABLES YES)
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_PACKAGE_DESCRIPTION "Git client for KDE")
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Hamed Masafi")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
if(KOMMIT_BUILD_DIR)
set(CPACK_PACKAGE_FILE_NAME "kommit")
else()
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
endif()
set(CPACK_COMPONENTS_GROUPING ONE_PER_GROUP)
# without this you won't be able to pack only specified component
set(CPACK_DEB_COMPONENT_INSTALL YES)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)