ECMQtDeclareLoggingCategory — Extra CMake Modules 5.21.0 documentation

# ECMQtDeclareLoggingCategory

Generate declarations for logging categories in Qt5.

    ecm_qt_declare_logging_category(<sources_var>
                                    HEADER <filename>
                                    IDENTIFIER <identifier>
                                    CATEGORY_NAME <category_name>
                                    [DEFAULT_SEVERITY
                                         <Debug|Info|Warning|
                                          Critical|Fatal>])

A header file, `<filename>`, will be generated along with a corresponding source file, which will be added to `<sources_var>`. These will provide a QLoggingCategory category that can be referred to from C++ code using `<identifier>`, and from the logging configuration using `<category_name>`.

If `<filename>` is not absolute, it will be taken relative to the current binary directory.

If the code is compiled against Qt 5.4 or later, by default it will only log output that is at least the severity specified by `DEFAULT_SEVERITY`, or “Warning” level if `DEFAULT_SEVERITY` is not given. Note that, due to a bug in Qt 5.5, “Info” may be treated as more severe than “Fatal”.

`<identifier>` may include namespaces (eg: `foo::bar::IDENT`).

Since 5.14.0.