<table><tr><td style="">habacker added a comment.<br />Restricted Application edited subscribers, added: kde-buildsystem, kde-frameworks-devel; removed: Frameworks, Build System.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D9446">View Revision</a></tr></table><br /><div><div><p>Having support for defining multiple debug categories has an additional  issue as shown with the following example. As far as I can see there should be only one header file for all categories in a repo eg. kcoreaddons_debug.h. To define all available debug categories for kcoreaddons the following cmake code is required.</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">ecm_qt_declare_logging_category(libkcoreaddons_SRCS
                                HEADER kcoreaddons_debug.h
                                IDENTIFIER KCOREADDONS_DEBUG
                                CATEGORY_NAME org.kde.kcoreaddons
                                CATEGORY_INSTALL_FILENAME kcoreaddons
                                CATEGORY_DESCRIPTION kcoreaddons)

ecm_qt_declare_logging_category(libkcoreaddons_SRCS
                                HEADER kcoreaddons_debug.h
                                IDENTIFIER MIGRATOR
                                CATEGORY_NAME kf5.kcoreaddons.kdelibs4configmigrator
                                DEFAULT_SEVERITY Warning
                                CATEGORY_INSTALL_FILENAME kcoreaddons
                                CATEGORY_DESCRIPTION Kdelibs4ConfigMigrator)

ecm_qt_declare_logging_category(libkcoreaddons_SRCS
                                HEADER kcoreaddons_debug.h
                                IDENTIFIER KDIRWATCH
                                CATEGORY_NAME kf5.kcoreaddons.kdirwatch
                                DEFAULT_SEVERITY Warning
                                CATEGORY_INSTALL_FILENAME kcoreaddons
                                CATEGORY_DESCRIPTION KDirWatch)

if(BUILDING_DESKTOPTOJSON_TOOL)
    set(Level Debug)
else()
    set(Level Warning)
endif()

ecm_qt_declare_logging_category(libkcoreaddons_SRCS
                                HEADER kcoreaddons_debug.h
                                IDENTIFIER DESKTOPPARSER
                                CATEGORY_NAME kf5.kcoreaddons.desktopparser
                                DEFAULT_SEVERITY ${LEVEL}
                                CATEGORY_INSTALL_FILENAME kcoreaddons
                                CATEGORY_DESCRIPTION KDesktopParser)

ecm_qt_declare_logging_category(libkcoreaddons_SRCS
                                HEADER kcoreaddons_debug.h
                                IDENTIFIER KABOUTDATA
                                CATEGORY_NAME kf5.kcoreaddons.kaboutdata
                                DEFAULT_SEVERITY Warning
                                CATEGORY_INSTALL_FILENAME kcoreaddons
                                CATEGORY_DESCRIPTION KAboutData)</pre></div>

<p>Unfortunally this creates kcoreaddons_debug.h only containing the definition for KABOUTDATA. The alternative to specify different files forces developers to know exactly which file to include for specifing a dedicated debug category.</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);"></pre></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R240 Extra CMake Modules</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D9446">https://phabricator.kde.org/D9446</a></div></div><br /><div><strong>To: </strong>mlaurent, kfunk, lbeltrame, cgiboudeaux, dfaure, fvogt<br /><strong>Cc: </strong>kde-frameworks-devel, kde-buildsystem, habacker, michaelh, ngraham, bruns, Frameworks, Build System<br /></div>