Changeset View
Changeset View
Standalone View
Standalone View
modules/ECMQtDeclareLoggingCategory.cmake
1 | #.rst: | 1 | #.rst: | ||
---|---|---|---|---|---|
2 | # ECMQtDeclareLoggingCategory | 2 | # ECMQtDeclareLoggingCategory | ||
3 | # --------------------------- | 3 | # --------------------------- | ||
4 | # | 4 | # | ||
5 | # Generate declarations for logging categories in Qt5. | 5 | # This module provides the ``ecm_qt_declare_logging_category`` function for | ||
6 | # generating declarations for logging categories in Qt5, and the | ||||
7 | # ``ecm_qt_install_logging_categories`` function for generating and installing | ||||
8 | # a file in KDebugSettings format with the info about all those categories, | ||||
9 | # as well as a file with info about any renamed categories if defined. | ||||
10 | # To include in that file any logging categories that are manually defined | ||||
11 | # also a function ``ecm_qt_export_logging_category`` is provided. | ||||
6 | # | 12 | # | ||
7 | # :: | 13 | # :: | ||
8 | # | 14 | # | ||
9 | # ecm_qt_declare_logging_category(<sources_var> | 15 | # ecm_qt_declare_logging_category(<sources_var> | ||
10 | # HEADER <filename> | 16 | # HEADER <filename> | ||
11 | # IDENTIFIER <identifier> | 17 | # IDENTIFIER <identifier> | ||
12 | # CATEGORY_NAME <category_name> | 18 | # CATEGORY_NAME <category_name> | ||
13 | # [DEFAULT_SEVERITY | 19 | # [OLD_CATEGORY_NAMES <oldest_cat_name> [<second_oldest_cat_name> [...]]] | ||
14 | # <Debug|Info|Warning| | 20 | # [DEFAULT_SEVERITY <Debug|Info|Warning|Critical|Fatal>] | ||
15 | # Critical|Fatal>]) | 21 | # [EXPORT <exportid>] | ||
22 | # [DESCRIPTION <description>] | ||||
23 | # ) | ||||
16 | # | 24 | # | ||
17 | # A header file, ``<filename>``, will be generated along with a corresponding | 25 | # A header file, ``<filename>``, will be generated along with a corresponding | ||
18 | # source file, which will be added to ``<sources_var>``. These will provide a | 26 | # source file, which will be added to ``<sources_var>``. These will provide a | ||
19 | # QLoggingCategory category that can be referred to from C++ code using | 27 | # QLoggingCategory category that can be referred to from C++ code using | ||
20 | # ``<identifier>``, and from the logging configuration using | 28 | # ``<identifier>``, and from the logging configuration using | ||
21 | # ``<category_name>``. | 29 | # ``<category_name>``. | ||
22 | # | 30 | # | ||
23 | # If ``<filename>`` is not absolute, it will be taken relative to the current | 31 | # If ``<filename>`` is not absolute, it will be taken relative to the current | ||
24 | # binary directory. | 32 | # binary directory. | ||
25 | # | 33 | # | ||
26 | # If the code is compiled against Qt 5.4 or later, by default it will only log | 34 | # If the code is compiled against Qt 5.4 or later, by default it will only log | ||
27 | # output that is at least the severity specified by ``DEFAULT_SEVERITY``, or | 35 | # output that is at least the severity specified by ``DEFAULT_SEVERITY``, or | ||
28 | # "Info" level if ``DEFAULT_SEVERITY`` is not given. Note that, due to a | 36 | # "Info" level if ``DEFAULT_SEVERITY`` is not given. Note that, due to a | ||
29 | # bug in Qt 5.5, "Info" may be treated as more severe than "Fatal". | 37 | # bug in Qt 5.5, "Info" may be treated as more severe than "Fatal". | ||
30 | # | 38 | # | ||
31 | # ``<identifier>`` may include namespaces (eg: ``foo::bar::IDENT``). | 39 | # ``<identifier>`` may include namespaces (eg: ``foo::bar::IDENT``). | ||
32 | # | 40 | # | ||
41 | # If ``EXPORT`` is passed, the category will be registered for the group id | ||||
42 | # ``<exportid>``. Info about the categories of that group can then be | ||||
43 | # generated in a file and installed by that group id with the | ||||
44 | # ``ecm_qt_install_logging_categories`` function. In that case also ``DESCRIPTION`` | ||||
45 | # will need to be passed, with ``<description>`` being a short single line text. | ||||
46 | # And ``OLD_CATEGORY_NAMES`` can be used to inform about any renamings of the category, | ||||
47 | # so user settings can be migrated. Since 5.68.0. | ||||
48 | # | ||||
33 | # Since 5.14.0. | 49 | # Since 5.14.0. | ||
50 | # | ||||
51 | # :: | ||||
52 | # | ||||
53 | # ecm_qt_export_logging_category( | ||||
54 | # IDENTIFIER <identifier> | ||||
55 | # CATEGORY_NAME <category_name> | ||||
56 | # [OLD_CATEGORY_NAMES <oldest_category_name> [<second_oldest_category_name> [...]]] | ||||
57 | # EXPORT <exportid> | ||||
58 | # DESCRIPTION <description> | ||||
59 | # [DEFAULT_SEVERITY <Debug|Info|Warning|Critical|Fatal>] | ||||
60 | # ) | ||||
61 | # | ||||
62 | # Registers a logging category for being included in the generated and | ||||
63 | # installed KDebugSettings files. To be used for categories who are declared by | ||||
64 | # manual code or other ways instead of code generated with | ||||
65 | # ``ecm_qt_declare_logging_category``. | ||||
66 | # | ||||
67 | # ``<identifier>`` may include namespaces (eg: ``foo::bar::IDENT``). | ||||
68 | # | ||||
69 | # ``EXPORT`` specifies the group id with which the category will be registered. | ||||
70 | # Info about the categories of that group can then be generated in a file and | ||||
71 | # installed by that group id with the ``ecm_qt_install_logging_categories`` function. | ||||
72 | # | ||||
73 | # ``DESCRIPTION`` specifies a short single line text describing the category. | ||||
74 | # | ||||
75 | # ``OLD_CATEGORY_NAMES`` can be used to inform about any renamings of the category, | ||||
76 | # so user settings can be migrated. | ||||
77 | # | ||||
78 | # Since 5.68.0. | ||||
79 | # | ||||
kossebau: Why the need for explicit DESTINATION argument, where almost all use-cases will use… | |||||
80 | # :: | ||||
81 | # | ||||
82 | # ecm_qt_install_logging_categories( | ||||
83 | # EXPORT <exportid> | ||||
84 | # [FILE <filename>] | ||||
85 | # DESTINATION <install_path> | ||||
86 | # [SORT] | ||||
87 | # [COMPONENT <component>] | ||||
88 | # ) | ||||
89 | # | ||||
90 | # Generates and installs a file in KDebugSettings format with the info about all | ||||
91 | # the categories registered for the group ``<exportid>``, as well as a file with | ||||
92 | # info about any renamed categories, if there are. | ||||
93 | # | ||||
94 | # The method call needs to be after the last ``ecm_qt_declare_logging_category`` | ||||
95 | # call which uses the same ``<exportid>``. This can be in the same directory, or | ||||
96 | # any subdirectory or parent directory. | ||||
97 | # | ||||
98 | # ``EXPORT`` specifies the group id of categories whose informatipn should be | ||||
99 | # stored in the file generated and installed. | ||||
100 | # | ||||
101 | # ``FILE`` specifies the name of the file generated and installed. It will default | ||||
102 | # to lower-cased ``<exportid>.categories``. | ||||
103 | # | ||||
104 | # ``DESTINATION`` specifies where the generated file will be | ||||
105 | # installed. | ||||
106 | # | ||||
107 | # IF ``SORT`` is set, entries will be sorted by identifiers. | ||||
108 | # | ||||
109 | # ``COMPONENT`` specifies the installation component name with which the install | ||||
110 | # rules for the generated file are associated. | ||||
111 | # | ||||
112 | # Example usage: | ||||
113 | # | ||||
114 | # .. code-block:: cmake | ||||
115 | # | ||||
116 | # ecm_qt_declare_logging_category( | ||||
117 | # MYPROJECT_SRCS | ||||
118 | # HEADER "myproject_debug.h" | ||||
119 | # IDENTIFIER "MYPROJECT_DEBUG" | ||||
120 | # CATEGORY_NAME "myproject" | ||||
121 | # OLD_CATEGORY_NAMES "myprojectlog" | ||||
122 | # DESCRIPTION "My project" | ||||
123 | # EXPORT MyProject | ||||
124 | # ) | ||||
125 | # | ||||
126 | # ecm_qt_export_logging_category( | ||||
127 | # IDENTIFIER "MYPROJECT_SUBMODULE_DEBUG" | ||||
128 | # CATEGORY_NAME "myproject.submodule" | ||||
129 | # DESCRIPTION "My project - submodule" | ||||
130 | # EXPORT MyProject | ||||
131 | # ) | ||||
132 | # | ||||
133 | # ecm_qt_install_logging_categories( | ||||
134 | # EXPORT MyProject | ||||
135 | # FILE myproject.categories | ||||
136 | # DESTINATION "${KDE_INSTALL_LOGGINGCATEGORIESDIR}" | ||||
137 | # ) | ||||
138 | # | ||||
139 | # Since 5.68.0. | ||||
34 | 140 | | |||
35 | #============================================================================= | 141 | #============================================================================= | ||
36 | # Copyright 2015 Alex Merry <alex.merry@kde.org> | 142 | # Copyright 2015 Alex Merry <alex.merry@kde.org> | ||
143 | # Copyright 2020 Friedrich W. H. Kossebau <kossebau@kde.org> | ||||
37 | # | 144 | # | ||
38 | # Redistribution and use in source and binary forms, with or without | 145 | # Redistribution and use in source and binary forms, with or without | ||
39 | # modification, are permitted provided that the following conditions | 146 | # modification, are permitted provided that the following conditions | ||
40 | # are met: | 147 | # are met: | ||
41 | # | 148 | # | ||
42 | # 1. Redistributions of source code must retain the copyright | 149 | # 1. Redistributions of source code must retain the copyright | ||
43 | # notice, this list of conditions and the following disclaimer. | 150 | # notice, this list of conditions and the following disclaimer. | ||
44 | # 2. Redistributions in binary form must reproduce the copyright | 151 | # 2. Redistributions in binary form must reproduce the copyright | ||
Show All 13 Lines | |||||
58 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 165 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
59 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 166 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
60 | 167 | | |||
61 | include(CMakeParseArguments) | 168 | include(CMakeParseArguments) | ||
62 | 169 | | |||
63 | set(_ECM_QT_DECLARE_LOGGING_CATEGORY_TEMPLATE_CPP "${CMAKE_CURRENT_LIST_DIR}/ECMQtDeclareLoggingCategory.cpp.in") | 170 | set(_ECM_QT_DECLARE_LOGGING_CATEGORY_TEMPLATE_CPP "${CMAKE_CURRENT_LIST_DIR}/ECMQtDeclareLoggingCategory.cpp.in") | ||
64 | set(_ECM_QT_DECLARE_LOGGING_CATEGORY_TEMPLATE_H "${CMAKE_CURRENT_LIST_DIR}/ECMQtDeclareLoggingCategory.h.in") | 171 | set(_ECM_QT_DECLARE_LOGGING_CATEGORY_TEMPLATE_H "${CMAKE_CURRENT_LIST_DIR}/ECMQtDeclareLoggingCategory.h.in") | ||
65 | 172 | | |||
173 | function(ecm_qt_export_logging_category) | ||||
174 | set(options) | ||||
175 | set(oneValueArgs IDENTIFIER CATEGORY_NAME DEFAULT_SEVERITY EXPORT DESCRIPTION) | ||||
176 | set(multiValueArgs OLD_CATEGORY_NAMES) | ||||
177 | cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||||
178 | | ||||
179 | if(ARG_UNPARSED_ARGUMENTS) | ||||
180 | message(FATAL_ERROR "Unexpected arguments to ecm_qt_export_logging_category: ${ARG_UNPARSED_ARGUMENTS}") | ||||
181 | endif() | ||||
182 | if(NOT ARG_IDENTIFIER) | ||||
183 | message(FATAL_ERROR "Missing IDENTIFIER argument for ecm_qt_export_logging_category") | ||||
184 | endif() | ||||
185 | if(NOT ARG_CATEGORY_NAME) | ||||
186 | message(FATAL_ERROR "Missing CATEGORY_NAME argument for ecm_qt_export_logging_category") | ||||
187 | endif() | ||||
188 | if(NOT ARG_DEFAULT_SEVERITY) | ||||
189 | set(ARG_DEFAULT_SEVERITY Info) | ||||
190 | set(is_explicite_default_severity FALSE) | ||||
191 | else() | ||||
192 | set(acceptible_severities Debug Info Warning Critical Fatal) | ||||
193 | list(FIND acceptible_severities "${ARG_DEFAULT_SEVERITY}" pos) | ||||
194 | if (pos EQUAL -1) | ||||
195 | message(FATAL_ERROR "Unknown DEFAULT_SEVERITY ${pos}") | ||||
196 | endif() | ||||
197 | set(is_explicite_default_severity TRUE) | ||||
198 | endif() | ||||
199 | if(NOT ARG_EXPORT) | ||||
200 | message(FATAL_ERROR "Missing EXPORT argument for ecm_qt_export_logging_category.") | ||||
201 | endif() | ||||
202 | if(NOT ARG_DESCRIPTION) | ||||
203 | message(FATAL_ERROR "Missing DESCRIPTION argument for ecm_qt_export_logging_category.") | ||||
204 | endif() | ||||
205 | | ||||
206 | # note data in global properties | ||||
207 | set(_propertyprefix "ECM_QT_LOGGING_CATEGORY_${ARG_EXPORT}") | ||||
208 | set_property(GLOBAL APPEND PROPERTY "${_propertyprefix}_CATEGORIES" ${ARG_CATEGORY_NAME}) | ||||
209 | set_property(GLOBAL PROPERTY "${_propertyprefix}_IDENTIFIER_${ARG_CATEGORY_NAME}" "${ARG_IDENTIFIER}") | ||||
210 | set_property(GLOBAL PROPERTY "${_propertyprefix}_DESCRIPTION_${ARG_CATEGORY_NAME}" "${ARG_DESCRIPTION}") | ||||
211 | set_property(GLOBAL PROPERTY "${_propertyprefix}_OLD_NAMES_${ARG_CATEGORY_NAME}" "${ARG_OLD_CATEGORY_NAMES}") | ||||
212 | if (is_explicite_default_severity) | ||||
213 | set_property(GLOBAL PROPERTY "${_propertyprefix}_DEFAULT_SEVERITY_${ARG_CATEGORY_NAME}" "${ARG_DEFAULT_SEVERITY}") | ||||
214 | endif() | ||||
215 | endfunction() | ||||
216 | | ||||
217 | | ||||
66 | function(ecm_qt_declare_logging_category sources_var) | 218 | function(ecm_qt_declare_logging_category sources_var) | ||
67 | set(options) | 219 | set(options) | ||
68 | set(oneValueArgs HEADER IDENTIFIER CATEGORY_NAME DEFAULT_SEVERITY) | 220 | set(oneValueArgs HEADER IDENTIFIER CATEGORY_NAME DEFAULT_SEVERITY EXPORT DESCRIPTION) | ||
69 | set(multiValueArgs) | 221 | set(multiValueArgs OLD_CATEGORY_NAMES) | ||
70 | cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | 222 | cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||
71 | 223 | | |||
72 | if(ARG_UNPARSED_ARGUMENTS) | 224 | if(ARG_UNPARSED_ARGUMENTS) | ||
73 | message(FATAL_ERROR "Unexpected arguments to ecm_qt_declare_logging_category: ${ARG_UNPARSED_ARGUMENTS}") | 225 | message(FATAL_ERROR "Unexpected arguments to ecm_qt_declare_logging_category: ${ARG_UNPARSED_ARGUMENTS}") | ||
74 | endif() | 226 | endif() | ||
75 | if(NOT ARG_HEADER) | 227 | if(NOT ARG_HEADER) | ||
76 | message(FATAL_ERROR "Missing HEADER argument for ecm_qt_declare_logging_category") | 228 | message(FATAL_ERROR "Missing HEADER argument for ecm_qt_declare_logging_category") | ||
77 | endif() | 229 | endif() | ||
78 | if(NOT ARG_IDENTIFIER) | 230 | if(NOT ARG_IDENTIFIER) | ||
79 | message(FATAL_ERROR "Missing IDENTIFIER argument for ecm_qt_declare_logging_category") | 231 | message(FATAL_ERROR "Missing IDENTIFIER argument for ecm_qt_declare_logging_category") | ||
80 | endif() | 232 | endif() | ||
81 | if(NOT ARG_CATEGORY_NAME) | 233 | if(NOT ARG_CATEGORY_NAME) | ||
82 | message(FATAL_ERROR "Missing CATEGORY_NAME argument for ecm_qt_declare_logging_category") | 234 | message(FATAL_ERROR "Missing CATEGORY_NAME argument for ecm_qt_declare_logging_category") | ||
83 | endif() | 235 | endif() | ||
84 | if(NOT ARG_DEFAULT_SEVERITY) | 236 | if(NOT ARG_DEFAULT_SEVERITY) | ||
85 | set(ARG_DEFAULT_SEVERITY Info) | 237 | set(ARG_DEFAULT_SEVERITY Info) | ||
238 | set(is_explicite_default_severity FALSE) | ||||
86 | else() | 239 | else() | ||
87 | set(acceptible_severities Debug Info Warning Critical Fatal) | 240 | set(acceptible_severities Debug Info Warning Critical Fatal) | ||
88 | list(FIND acceptible_severities "${ARG_DEFAULT_SEVERITY}" pos) | 241 | list(FIND acceptible_severities "${ARG_DEFAULT_SEVERITY}" pos) | ||
89 | if (pos EQUAL -1) | 242 | if (pos EQUAL -1) | ||
90 | message(FATAL_ERROR "Unknown DEFAULT_SEVERITY ${pos}") | 243 | message(FATAL_ERROR "Unknown DEFAULT_SEVERITY ${pos}") | ||
91 | endif() | 244 | endif() | ||
245 | set(is_explicite_default_severity TRUE) | ||||
246 | endif() | ||||
247 | if(ARG_EXPORT AND NOT ARG_DESCRIPTION) | ||||
248 | message(FATAL_ERROR "Missing DESCRIPTION argument for ecm_qt_declare_logging_category.") | ||||
92 | endif() | 249 | endif() | ||
93 | 250 | | |||
94 | if (NOT IS_ABSOLUTE "${ARG_HEADER}") | 251 | if (NOT IS_ABSOLUTE "${ARG_HEADER}") | ||
95 | set(ARG_HEADER "${CMAKE_CURRENT_BINARY_DIR}/${ARG_HEADER}") | 252 | set(ARG_HEADER "${CMAKE_CURRENT_BINARY_DIR}/${ARG_HEADER}") | ||
96 | endif() | 253 | endif() | ||
97 | 254 | | |||
98 | string(REPLACE "::" ";" namespaces "${ARG_IDENTIFIER}") | 255 | string(REPLACE "::" ";" namespaces "${ARG_IDENTIFIER}") | ||
99 | list(LENGTH namespaces len) | 256 | list(LENGTH namespaces len) | ||
Show All 27 Lines | |||||
127 | endif() | 284 | endif() | ||
128 | 285 | | |||
129 | configure_file("${_ECM_QT_DECLARE_LOGGING_CATEGORY_TEMPLATE_CPP}" "${cpp_filename}") | 286 | configure_file("${_ECM_QT_DECLARE_LOGGING_CATEGORY_TEMPLATE_CPP}" "${cpp_filename}") | ||
130 | configure_file("${_ECM_QT_DECLARE_LOGGING_CATEGORY_TEMPLATE_H}" "${ARG_HEADER}") | 287 | configure_file("${_ECM_QT_DECLARE_LOGGING_CATEGORY_TEMPLATE_H}" "${ARG_HEADER}") | ||
131 | 288 | | |||
132 | set(sources "${${sources_var}}") | 289 | set(sources "${${sources_var}}") | ||
133 | list(APPEND sources "${cpp_filename}") | 290 | list(APPEND sources "${cpp_filename}") | ||
134 | set(${sources_var} "${sources}" PARENT_SCOPE) | 291 | set(${sources_var} "${sources}" PARENT_SCOPE) | ||
292 | | ||||
293 | # note data in global properties | ||||
294 | if (ARG_EXPORT) | ||||
295 | set(_default_severity) | ||||
296 | if (is_explicite_default_severity) | ||||
297 | set(_default_severity DEFAULT_SEVERITY ${ARG_DEFAULT_SEVERITY}) | ||||
298 | endif() | ||||
299 | set(_old_category_name) | ||||
300 | if (ARG_OLD_CATEGORY_NAMES) | ||||
301 | set(_old_category_names OLD_CATEGORY_NAMES ${ARG_OLD_CATEGORY_NAMES}) | ||||
302 | endif() | ||||
303 | ecm_qt_export_logging_category( | ||||
304 | IDENTIFIER ${ARG_IDENTIFIER} | ||||
305 | CATEGORY_NAME ${ARG_CATEGORY_NAME} | ||||
306 | ${_old_category_names} | ||||
307 | ${_default_severity} | ||||
308 | EXPORT ${ARG_EXPORT} | ||||
309 | DESCRIPTION "${ARG_DESCRIPTION}" | ||||
310 | ) | ||||
311 | endif() | ||||
312 | endfunction() | ||||
313 | | ||||
314 | | ||||
315 | function(ecm_qt_install_logging_categories) | ||||
316 | set(options SORT) | ||||
317 | set(oneValueArgs FILE EXPORT DESTINATION COMPONENT) | ||||
318 | set(multiValueArgs) | ||||
319 | | ||||
320 | cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||||
321 | | ||||
322 | if(NOT ARGS_EXPORT) | ||||
323 | message(FATAL_ERROR "Missing EXPORT argument for ecm_qt_install_logging_categories") | ||||
324 | endif() | ||||
325 | | ||||
326 | if(NOT ARGS_DESTINATION) | ||||
327 | message(FATAL_ERROR "Missing DESTINATION argument for ecm_qt_install_logging_categories") | ||||
328 | endif() | ||||
329 | | ||||
330 | if(NOT ARGS_FILE) | ||||
331 | string(TOLOWER "${ARGS_EXPORT}.categories" ARGS_FILE) | ||||
332 | endif() | ||||
333 | | ||||
334 | set(_propertyprefix "ECM_QT_LOGGING_CATEGORY_${ARGS_EXPORT}") | ||||
335 | get_property(has_category GLOBAL PROPERTY "${_propertyprefix}_CATEGORIES" SET) | ||||
336 | | ||||
337 | if (NOT has_category) | ||||
338 | message(FATAL_ERROR "${ARGS_EXPORT} is an unknown qt logging category export name.") | ||||
339 | endif() | ||||
340 | | ||||
341 | get_property(_categories GLOBAL PROPERTY "${_propertyprefix}_CATEGORIES") | ||||
342 | if (ARGS_SORT) | ||||
343 | list(SORT _categories) | ||||
344 | endif() | ||||
345 | | ||||
346 | set(_renamed_categories) | ||||
347 | | ||||
348 | # generate categories file | ||||
349 | if (NOT IS_ABSOLUTE "${ARGS_FILE}") | ||||
350 | set(ARGS_FILE "${CMAKE_CURRENT_BINARY_DIR}/${ARGS_FILE}") | ||||
351 | endif() | ||||
352 | | ||||
353 | file(WRITE ${ARGS_FILE} | ||||
354 | "# KDebugSettings data file | ||||
355 | # This file was generated by ecm_qt_install_logging_categories(). DO NOT EDIT! | ||||
356 | | ||||
357 | ") | ||||
358 | | ||||
359 | foreach(_category IN LISTS _categories) | ||||
360 | get_property(_description GLOBAL PROPERTY "${_propertyprefix}_DESCRIPTION_${_category}") | ||||
361 | get_property(_identifier GLOBAL PROPERTY "${_propertyprefix}_IDENTIFIER_${_category}") | ||||
362 | get_property(_default_severity GLOBAL PROPERTY "${_propertyprefix}_DEFAULT_SEVERITY_${_category}") | ||||
363 | if (_default_severity) | ||||
364 | string(TOUPPER "${_default_severity}" _default_severity) | ||||
365 | set(_default_severity "DEFAULT_SEVERITY [${_default_severity}] ") # final space wanted | ||||
366 | endif() | ||||
367 | get_property(_old_category_names GLOBAL PROPERTY "${_propertyprefix}_OLD_NAMES_${_category}") | ||||
368 | if (_old_category_names) | ||||
369 | list(APPEND _renamed_categories ${_category}) | ||||
370 | endif() | ||||
371 | | ||||
372 | # Format: | ||||
373 | # logname<space>description(optional <space> DEFAULT_SEVERITY [DEFAULT_CATEGORY] as WARNING/DEBUG/INFO/CRITICAL) optional IDENTIFIER [...]) | ||||
374 | file(APPEND ${ARGS_FILE} "${_category} ${_description} ${_default_severity}IDENTIFIER [${_identifier}]\n") | ||||
375 | endforeach() | ||||
376 | | ||||
377 | set(_renamed_cats_file) | ||||
378 | if (_renamed_categories) | ||||
379 | get_filename_component(_dir ${ARGS_FILE} DIRECTORY) | ||||
380 | get_filename_component(_base_name ${ARGS_FILE} NAME_WLE) | ||||
381 | set(_renamed_cats_file "${_dir}/${_base_name}.renamecategories") | ||||
382 | file(WRITE ${_renamed_cats_file} | ||||
383 | "# KDebugSettings data file | ||||
384 | # This file was generated by ecm_qt_install_logging_categories(). DO NOT EDIT! | ||||
385 | | ||||
386 | ") | ||||
387 | | ||||
388 | foreach(_category IN LISTS _renamed_categories) | ||||
389 | get_property(_category_name_history GLOBAL PROPERTY "${_propertyprefix}_OLD_NAMES_${_category}") | ||||
390 | | ||||
391 | list(APPEND _category_name_history ${_category}) | ||||
392 | list(GET _category_name_history 0 _old_category_name) | ||||
393 | list(REMOVE_AT _category_name_history 0) | ||||
394 | foreach(_category_name IN LISTS _category_name_history) | ||||
395 | # Format: | ||||
396 | # oldlogname<space>newlogname | ||||
397 | file(APPEND ${_renamed_cats_file} "${_old_category_name} ${_category_name}\n") | ||||
398 | set(_old_category_name ${_category_name}) | ||||
399 | endforeach() | ||||
400 | endforeach() | ||||
401 | endif() | ||||
402 | | ||||
403 | # install files | ||||
404 | set(_component_install) | ||||
405 | if (ARGS_COMPONENT) | ||||
406 | set(_component_install COMPONENT ${ARGS_COMPONENT}) | ||||
407 | endif() | ||||
408 | install( | ||||
409 | FILES ${ARGS_FILE} ${_renamed_cats_file} | ||||
410 | DESTINATION "${ARGS_DESTINATION}" | ||||
411 | ${_component_install} | ||||
412 | ) | ||||
135 | endfunction() | 413 | endfunction() |
Why the need for explicit DESTINATION argument, where almost all use-cases will use ${KDE_INSTALL_LOGGINGCATEGORIESDIR}?
Because ECMQtDeclareLoggingCategory is part of modules, not kde-modules, so KDEInstallDirs cannot be used.
One could think about having a wrapper module in kde-modules. But such a wrapper script would be nice for more things actually, given all the repeated boilerpplate across e.g. all the KF repos :)
So asking for explicit mention of the installation destination is consistent.