D9446: WIP: Allow to autogenerate and install categories file

Ralf Habacker noreply at phabricator.kde.org
Thu Jun 28 08:47:53 UTC 2018


habacker added a comment.


  In D9446#284272 <https://phabricator.kde.org/D9446#284272>, @habacker wrote:
  
  > In D9446#181785 <https://phabricator.kde.org/D9446#181785>, @mlaurent wrote:
  >
  > > IT's a WIP as I use file(APPEND...) because I want to generate several categories in one file.
  > >  But it doesn't work as I don't have idea how to reset file when cmake is started...
  > >
  > > Do you have an idea ?
  >
  >
  > No cmake experts on the KF5 team like it was at KDE4?
  
  
  I tried this, which seems to work
  
    #.rst:
    # ECMQtDeclareLoggingCategory
    ...
    set_property(GLOBAL PROPERTY _ecm_qtdlc_counter "0")
    ...
    function(ecm_qt_declare_logging_category sources_var)
      ...
      if (ARG_CATEGORY_INSTALL_FILENAME)
          set(cat_file ${CMAKE_BINARY_DIR}/${ARG_CATEGORY_INSTALL_FILENAME}.categories)
          get_property(counter GLOBAL PROPERTY _ecm_qtdlc_counter)
          if(counter STREQUAL "0")
              file(WRITE ${cat_file} "")
          endif()
    
          set(CAT_DESCRIPTION)
          if (ARG_CATEGORY_DESCRIPTION)
              set(CAT_DESCRIPTION ${ARG_CATEGORY_DESCRIPTION})
          endif()
          file(APPEND ${cat_file} "${ARG_CATEGORY_NAME} ${CAT_DESCRIPTION}\n")
          MESSAGE(STATUS "${cat_file} ${CAT_DESCRIPTION}")
          install( FILES ${cat_file} DESTINATION ${KDE_INSTALL_CONFDIR} )
          math(EXPR counter "${counter} + 1")
          set_property(GLOBAL PROPERTY _ecm_qtdlc_counter "${counter}")
      endif()

REPOSITORY
  R240 Extra CMake Modules

REVISION DETAIL
  https://phabricator.kde.org/D9446

To: mlaurent, kfunk, lbeltrame, cgiboudeaux, dfaure, fvogt
Cc: ltoscano, kde-frameworks-devel, kde-buildsystem, habacker, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-buildsystem/attachments/20180628/31d8befd/attachment.html>


More information about the Kde-buildsystem mailing list