-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
85 lines (65 loc) · 2.01 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
project(policykit-unity8 CXX)
cmake_minimum_required (VERSION 3.0.0)
set (PACKAGE_VERSION "0.1")
set (PACKAGE ${CMAKE_PROJECT_NAME})
##
## Directories
##
include (GNUInstallDirs)
if (EXISTS "/etc/debian_version")
set(CMAKE_INSTALL_LIBEXECDIR ${CMAKE_INSTALL_LIBDIR})
set(CMAKE_INSTALL_FULL_LIBEXECDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}")
endif()
set(CMAKE_INSTALL_PKGLIBEXECDIR "${CMAKE_INSTALL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}")
set(CMAKE_INSTALL_FULL_PKGLIBEXECDIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}")
set(CMAKE_INSTALL_FULL_PKGDATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${CMAKE_PROJECT_NAME}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Werror -std=c++14 -pthread ${GCOV_FLAGS}")
##
## Pkgconfig
##
find_package(PkgConfig REQUIRED)
pkg_check_modules(POLICYKIT REQUIRED polkit-agent-1)
pkg_check_modules(GIO REQUIRED gio-2.0)
pkg_check_modules(NOTIFY REQUIRED libnotify)
##
## Include code formatting
##
set_property(GLOBAL PROPERTY FORMAT_SOURCES)
find_package(FormatCode)
##
## Go deeper into the tree
##
add_subdirectory(service)
add_subdirectory(data)
add_subdirectory(po)
##
## Testing
##
option (enable_tests "Build the package's automatic tests." ON)
if (${enable_tests})
enable_testing()
endif()
add_subdirectory(tests)
##
## Coverage
##
find_package(CoverageReport)
set(filter-list)
list(APPEND filter-list "/usr")
list(APPEND filter-list "${CMAKE_SOURCE_DIR}/tests")
list(APPEND filter-list "${CMAKE_SOURCE_DIR}/service/glib-thread.*")
if (NOT ${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
list(APPEND filter-list "${CMAKE_BINARY_DIR}")
endif()
ENABLE_COVERAGE_REPORT(
TARGETS service-lib policykit-agent
TESTS agent-test authentication-test auth-manager-test
FILTER ${filter-list}
)
##
## Do formatting
##
get_property(FORMAT_SOURCES_LOCAL GLOBAL PROPERTY FORMAT_SOURCES)
message(STATUS "Formatting sources: ${FORMAT_SOURCES_LOCAL}")
add_formatcode_target(${FORMAT_SOURCES_LOCAL} STYLE_NAME unity-api)
#add_formatcode_test(${FORMAT_SOURCES_LOCAL} STYLE_NAME unity-api)