Merge lp:~pete-woods/cmake-extras/gdbus-conventional-appending-lp1671807 into lp:cmake-extras

Proposed by Pete Woods on 2017-03-10
Status: Merged
Approved by: dobey on 2017-03-10
Approved revision: 71
Merged at revision: 71
Proposed branch: lp:~pete-woods/cmake-extras/gdbus-conventional-appending-lp1671807
Merge into: lp:cmake-extras
Diff against target: 113 lines (+30/-16)
3 files modified
debian/changelog (+6/-0)
examples/gdbus-demo/CMakeLists.txt (+7/-5)
src/GDbus/GDbusConfig.cmake (+17/-11)
To merge this branch: bzr merge lp:~pete-woods/cmake-extras/gdbus-conventional-appending-lp1671807
Reviewer Review Type Date Requested Status
dobey (community) 2017-03-10 Approve on 2017-03-10
Review via email: mp+319563@code.launchpad.net

Commit message

Switch to conventional generated source appending for GDbus macros

Description of the change

Switch to conventional generated source appending for GDbus macros

To post a comment you must log in.
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2017-02-28 17:48:01 +0000
3+++ debian/changelog 2017-03-10 12:30:47 +0000
4@@ -1,3 +1,9 @@
5+cmake-extras (1.3-0ubuntu1) UNRELEASED; urgency=medium
6+
7+ * Make GDBus source name generation work like more conventional macros.
8+
9+ -- Pete <pete.woods@canonical.com> Fri, 10 Mar 2017 12:21:39 +0000
10+
11 cmake-extras (1.2+17.04.20170228-0ubuntu1) zesty; urgency=medium
12
13 * Add function to compile GSettings schemas. (LP: #1664714)
14
15=== modified file 'examples/gdbus-demo/CMakeLists.txt'
16--- examples/gdbus-demo/CMakeLists.txt 2017-02-24 19:55:58 +0000
17+++ examples/gdbus-demo/CMakeLists.txt 2017-03-10 12:30:47 +0000
18@@ -19,15 +19,19 @@
19 include_directories(${GLIB_INCLUDE_DIRS})
20 include_directories(${CMAKE_CURRENT_BINARY_DIR})
21
22+set(SOURCES
23+ main.cpp
24+)
25+
26 add_gdbus_codegen(
27- DBUS_STANDARD
28+ SOURCES
29 dbus-standard
30 org.freedesktop
31 org.freedesktop.DBus.xml
32 )
33
34 add_gdbus_codegen(
35- DBUS_NAMESPACED
36+ SOURCES
37 dbus-namespaced
38 org.freedesktop
39 org.freedesktop.DBus.xml
40@@ -37,9 +41,7 @@
41 add_executable(
42 test-gdbus
43
44- main.cpp
45- ${DBUS_STANDARD_SOURCES}
46- ${DBUS_NAMESPACED_SOURCES}
47+ ${SOURCES}
48 )
49 target_link_libraries(
50 test-gdbus
51
52=== modified file 'src/GDbus/GDbusConfig.cmake'
53--- src/GDbus/GDbusConfig.cmake 2017-02-28 17:39:43 +0000
54+++ src/GDbus/GDbusConfig.cmake 2017-03-10 12:30:47 +0000
55@@ -41,23 +41,23 @@
56 #.. command:: add_gdbus_codegen
57 #
58 # Generates C code and header file from XML service description, and
59-# sets the :variable:<VARIABLE_PREFIX>_SOURCES variable with the newly
60-# generated source files. This variable should be added to the list of
61-# sources for your :command:add_executable or :command:add_library target.
62+# appends the sources to the SOURCES list provided.
63 #
64-# add_gdbus_codegen(<VARIABLE_PREFIX> <NAME> <PREFIX> <SERVICE_XML> [NAMESPACE])
65+# add_gdbus_codegen(<SOURCES> <NAME> <PREFIX> <SERVICE_XML> [NAMESPACE])
66 #
67 # For example:
68 #
69 # .. code-block:: cmake
70 #
71-# add_gdbus_codegen(DBUS_PROXY
72+# set(MY_SOURCES foo.c)
73+#
74+# add_gdbus_codegen(MY_SOURCES
75 # dbus-proxy
76 # org.freedesktop
77 # org.freedesktop.DBus.xml
78 # )
79 #
80-function(ADD_GDBUS_CODEGEN VARIABLE_PREFIX NAME PREFIX SERVICE_XML)
81+function(ADD_GDBUS_CODEGEN _SOURCES _NAME _PREFIX SERVICE_XML)
82 set(_options ALL)
83 set(_oneValueArgs NAMESPACE)
84
85@@ -70,17 +70,23 @@
86 set(_NAMESPACE "--c-namespace=${_ARG_NAMESPACE}")
87 endif()
88
89- set(_OUTPUT_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/${NAME}")
90+ set(_OUTPUT_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/${_NAME}")
91 set(_OUTPUT_FILES "${_OUTPUT_PREFIX}.c" "${_OUTPUT_PREFIX}.h")
92- set("${VARIABLE_PREFIX}_SOURCES" "${_OUTPUT_FILES}" PARENT_SCOPE)
93+
94+ # for backwards compatibility
95+ set("${_SOURCES}_SOURCES" "${_OUTPUT_FILES}" PARENT_SCOPE)
96+
97+
98+ list(APPEND ${_SOURCES} ${_OUTPUT_FILES})
99+ set(${_SOURCES} ${${_SOURCES}} PARENT_SCOPE)
100+
101 add_custom_command(
102 OUTPUT ${_OUTPUT_FILES}
103 COMMAND "${GDBUS_CODEGEN_EXECUTABLE}"
104- --interface-prefix ${PREFIX}
105- --generate-c-code="${NAME}"
106+ --interface-prefix ${_PREFIX}
107+ --generate-c-code="${_NAME}"
108 ${_NAMESPACE}
109 ${_ABS_SERVICE_XML}
110- BYPRODUCTS ${_OUTPUT_FILES}
111 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
112 DEPENDS ${_ABS_SERVICE_XML}
113 )

Subscribers

People subscribed via source and target branches

to all changes: