Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-105218

qt6_ifcodegen_generate should not add PUBLIC_LIBRARIES if the target is a plugin

XMLWordPrintable

    • 21202aeaac (qt/qtinterfaceframework/dev) 84ff7c8a9c (qt/qtinterfaceframework/6.4) 84ff7c8a9c (qt/tqtc-qtinterfaceframework/6.4) 21202aeaac (qt/tqtc-qtinterfaceframework/dev) 84ff7c8a9c (qt/tqtc-qtinterfaceframework/6.4.0)

      The template files used to generate cmake files by qt6_ifcodegen_generate have content like

      qt6_set_ifcodegen_variable(${VAR_PREFIX}_LIBRARIES
          Qt6::InterfaceFramework
          Qt6::RemoteObjects
          Qt6::IfRemoteObjectsHelperPrivate
      )
      target_link_libraries(${CURRENT_TARGET} PUBLIC
              ${${VAR_PREFIX}_LIBRARIES}
          )
      

      PUBLIC linkage when ${CURRENT_TARGET} is a plugin does not make sense.
      Doing that can cause configuration failures when the target is exported and used in a different project, where the PUBLIC library target might not be available.

      So the template should not use PUBLIC, but PRIVATE when the target is a plugin.

      Whether PRIVATE should be used for regular module libraries, not plugins, depends on the context, and I'm missing the context due to unfamiliarity with the module and how it it's meant to be used.
      Usually a library "A" should be a PUBLIC dependency of "B" if A ships header files and A's header include directories need to be passed to the compiler, when compiling B's sources.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            gagi Dominik Holland
            alexandru.croitor Alexandru Croitor
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes