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

Details

    • 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)

    Description

      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.

      Attachments

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes