-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathCMakeLists.txt
117 lines (95 loc) · 3.31 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.18.0 FATAL_ERROR)
# CMP0000: Call the cmake_minimum_required() command at the beginning of the top-level
# CMakeLists.txt file even before calling the project() command.
# The cmake_minimum_required(VERSION) command implicitly invokes the cmake_policy(VERSION)
# command to specify that the current project code is written for the given range of CMake
# versions.
project(lxqt-policykit-agent)
include(GNUInstallDirs)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
find_package(PkgConfig)
pkg_check_modules(POLKIT_AGENT REQUIRED polkit-agent-1)
message(STATUS "polkit agent: ${POLKIT_AGENT_INCLUDE_DIRS} ${POLKIT_AGENT_LIBRARIES}")
set(POLKIT_AGENT_BINARY_DIR "${CMAKE_INSTALL_BINDIR}" CACHE FILEPATH "Directory for install polkit agent")
# Minumum Versions
set(LXQT_MINIMUM_VERSION "2.1.0")
set(QT_MINIMUM_VERSION "6.6.0")
find_package(Qt6 ${QT_MINIMUM_VERSION} COMPONENTS REQUIRED LinguistTools)
find_package(Qt6Widgets ${QT_MINIMUM_VERSION} REQUIRED)
find_package(lxqt ${LXQT_MINIMUM_VERSION} REQUIRED)
find_package(PolkitQt6-1 REQUIRED)
message(STATUS "Building with Qt${Qt5Core_VERSION}")
# Patch Version
set(LXQT_POLKITAGENT_PATCH_VERSION 0)
set(LXQT_POLKITAGENT_VERSION ${LXQT_MAJOR_VERSION}.${LXQT_MINOR_VERSION}.${LXQT_POLKITAGENT_PATCH_VERSION})
add_definitions(
"-DLXQT_POLKITAGENT_VERSION=\"${LXQT_POLKITAGENT_VERSION}\""
)
include(LXQtPreventInSourceBuilds)
include(LXQtCompilerSettings NO_POLICY_SCOPE)
message(STATUS "PolkitQt-1: ${POLKITQT-1_VERSION_STRING}")
message(STATUS " install: ${POLKITQT-1_INSTALL_DIR}")
message(STATUS " libs: ${POLKITQT-1_CORE_LIBRARY} ${POLKITQT-1_AGENT_LIBRARY}")
message(STATUS " include: ${POLKITQT-1_INCLUDE_DIR}")
# TODO/FIXME: pkg-config for hardcoded paths
# pkg-config --cflags glib-2.0
# pkg-config --cflags polkit-agent-1
include_directories(
${POLKIT_AGENT_INCLUDE_DIRS}
"${POLKITQT-1_INCLUDE_DIR}"
)
set(lxqt-policykit-agent_SRCS
src/main.cpp
src/policykitagent.cpp
src/policykitagentgui.cpp
)
set(lxqt-policykit-agent_H
src/policykitagent.h
src/policykitagentgui.h
)
set(lxqt-policykit-agent_UI
src/policykitagentgui.ui
)
# Translations **********************************
include(LXQtTranslate)
lxqt_translate_ts(lxqt-policykit-agent_QM_FILES
UPDATE_TRANSLATIONS
${UPDATE_TRANSLATIONS}
SOURCES
${lxqt-policykit-agent_H}
${lxqt-policykit-agent_SRCS}
${lxqt-policykit-agent_UI}
INSTALL_DIR
"${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME}"
)
lxqt_app_translation_loader(QM_LOADER ${PROJECT_NAME})
#************************************************
add_executable(lxqt-policykit-agent
${lxqt-policykit-agent_SRCS}
${lxqt-policykit-agent_MOCS}
${lxqt-policykit-agent_QM_FILES}
${QM_LOADER}
)
target_link_libraries(lxqt-policykit-agent
Qt6::Widgets
lxqt
${POLKITQT-1_CORE_LIBRARY}
${POLKITQT-1_AGENT_LIBRARY}
${POLKIT_AGENT_LDFLAGS}
)
# install
install(TARGETS
lxqt-policykit-agent
DESTINATION "${POLKIT_AGENT_BINARY_DIR}"
COMPONENT Runtime
)
install(FILES
man/lxqt-policykit-agent.1
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1"
COMPONENT Runtime
)
add_subdirectory(autostart)