aboutsummaryrefslogtreecommitdiff
path: root/libunity-greeter-session-broadcast/CMakeLists.txt
blob: 7db1f6da6de1fd115ae7ccecddfe644f3c704090 (plain)
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

###########################
# Version Information
###########################

set(API_VERSION 1)
set(ABI_VERSION 1)

###########################
# Generated Lib
###########################

set(GENERATED_HEADERS
service-iface.h
)

set(GENERATED_SOURCES
service-iface.c
)

add_gdbus_codegen(
OUTFILES GENERATED_SOURCES
NAME service-iface
PREFIX com.canonical.Unity.Greeter.Broadcast.
NAMESPACE _ServiceIface
SERVICE_XML ${CMAKE_CURRENT_SOURCE_DIR}/../data/com.canonical.Unity.Greeter.Broadcast.xml
)

add_library(generated STATIC ${GENERATED_SOURCES})

target_link_libraries(generated
${GLIB2_LIBRARIES}
${GOBJECT2_LIBRARIES}
${GIO2_LIBRARIES}
)

###########################
# Lib
###########################

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")

set(BROADCAST_HEADERS
unity-greeter-session-broadcast.h
)

set(BROADCAST_SOURCES
unity-greeter-session-broadcast.c
)

add_library(broadcast SHARED ${BROADCAST_SOURCES})

set_target_properties(broadcast PROPERTIES
  VERSION ${API_VERSION}.0.0
  SOVERSION ${ABI_VERSION}
  OUTPUT_NAME "unity-greeter-session-broadcast"
)

target_link_libraries(broadcast
generated
${GLIB2_LIBRARIES}
${GOBJECT2_LIBRARIES}
-Wl,--no-undefined
)

###########################
# Pkg Config
###########################

set(BROADCAST_PC "unity-greeter-session-broadcast-${API_VERSION}.pc")
set(apiversion "${API_VERSION}")
set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}")
set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
set(VERSION "${ABI_VERSION}")

configure_file("unity-greeter-session-broadcast.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/${BROADCAST_PC}" @ONLY)

###########################
# Installation
###########################

install(
  FILES ${BROADCAST_HEADERS}
  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libunity-greeter-session-broadcast-${API_VERSION}"
)

install(
  FILES "${CMAKE_CURRENT_BINARY_DIR}/${BROADCAST_PC}"
  DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)

install(
  TARGETS broadcast
  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)