-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathCMakeLists.txt
109 lines (92 loc) · 2.58 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
cmake_minimum_required(VERSION 3.6)
cmake_policy(SET CMP0048 NEW)
if (POLICY CMP0043)
cmake_policy(SET CMP0043 NEW)
endif()
if (POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif()
project(packagekit-qt VERSION 1.1.3)
# Used to set installation paths
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(BUILD_SHARED_LIBS ON)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
include(GNUInstallDirs)
set(QPACKAGEKIT_API_LEVEL "1")
option(BUILD_WITH_QT6 "Use Qt6 instead of Qt5" OFF)
if(BUILD_WITH_QT6)
set(QT_VERSION_MAJOR 6)
else()
set(QT_VERSION_MAJOR 5)
endif()
find_package(Qt${QT_VERSION_MAJOR} 5.10 REQUIRED COMPONENTS Core DBus)
add_definitions(
-DQT_NO_KEYWORDS
-DQT_NO_CAST_TO_ASCII
-DQT_NO_CAST_FROM_ASCII
-DQT_STRICT_ITERATORS
-DQT_NO_URL_CAST_FROM_STRING
-DQT_NO_CAST_FROM_BYTEARRAY
-DQT_USE_QSTRINGBUILDER
-DQT_NO_SIGNALS_SLOTS_KEYWORDS
-DQT_USE_FAST_OPERATOR_PLUS
-DQT_DISABLE_DEPRECATED_BEFORE=0x050900
)
# Forbid in-tree building
if(${CMAKE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR})
message(STATUS "Please do an out-of-tree build:")
message(STATUS "rm -f CMakeCache.txt && mkdir build && cd build; cmake .. && make")
message(FATAL_ERROR "In-tree-build detected!")
endif()
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX
"/usr" CACHE PATH "QPK default install prefix" FORCE)
endif()
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
#
# Configure files
#
set (GETTEXT_PACKAGE "packagekit")
set (VERSION "${QPACKAGEKIT_VERSION}")
set (LOCALSTATEDIR "/var")
set (CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/packagekitqt${QT_VERSION_MAJOR}/")
add_definitions("-DLOCALSTATEDIR=\"${LOCALSTATEDIR}\"")
set (CMAKE_CXX_STANDARD 17)
configure_file(config.h.in ${CMAKE_BINARY_DIR}/config.h)
#
# Custom C flags
#
add_definitions(
"-Wformat"
"-Wno-unused-parameter"
"-Werror=empty-body"
"-Werror=pointer-arith"
"-Werror=init-self"
"-Werror=missing-declarations"
"-Werror=return-type"
"-Werror=misleading-indentation"
"-Werror=format-security"
)
option (MAINTAINER "Enable maintainer CFlags" OFF)
if (MAINTAINER)
set(MAINTAINER_CFLAGS
"-Werror"
"-Wall"
"-Wcast-align"
"-Wno-uninitialized"
"-Wempty-body"
"-Winit-self"
"-Wnull-dereference"
"-Wfloat-equal"
"-Winline"
)
add_definitions(${MAINTAINER_CFLAGS})
endif()
add_subdirectory(src)
install(EXPORT PackageKitQtTargets
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
FILE PackageKitQtTargets.cmake
NAMESPACE PK::
COMPONENT Devel)