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

qt_add_plugin should accept sources argument

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 6.5.0 Beta1
    • Component/s: Build System: CMake
    • Labels:
      None
    • Commits:
      7ce82225f6 (qt/qtbase/dev) 7ce82225f6 (qt/tqtc-qtbase/dev)

      Description

      currently, qt_add_plugin requires target_sources to add sources

      # https://github.com/qt/qtwayland/blob/dev/examples/wayland/custom-shell/client-plugin/CMakeLists.txt
      
      qt_add_plugin(exampleshellplugin)
      
      target_sources(exampleshellplugin PRIVATE
          main.cpp
          exampleshellintegration.cpp exampleshellintegration.h
          examplesurface.cpp examplesurface.h
      )
      

      ... because qt_add_plugin does not accept a sources argument

      https://doc.qt.io/qt-6/qt-add-plugin.html

      qt_add_plugin(target
                    [SHARED | STATIC]
                    [CLASS_NAME class_name]
                    [OUTPUT_TARGETS variable_name]
      )
      

      but all the other functions allow a sources argument

      https://doc.qt.io/qt-6/qt-add-library.html

      qt_add_library(target
          [STATIC | SHARED | MODULE | INTERFACE | OBJECT]
          [MANUAL_FINALIZATION]
          sources...
      )
      

      https://doc.qt.io/qt-6/qt-add-executable.html

      qt_add_executable(target
                        [WIN32] [MACOSX_BUNDLE]
                        [MANUAL_FINALIZATION]
                        sources...)
      

      ... which is consistent with other cmake functions

      https://cmake.org/cmake/help/latest/command/add_library.html

      add_library(<name> [STATIC | SHARED | MODULE]
                  [EXCLUDE_FROM_ALL]
                  [<source>...])
      

      https://cmake.org/cmake/help/latest/command/add_executable.html

      add_executable(<name> [WIN32] [MACOSX_BUNDLE]
                     [EXCLUDE_FROM_ALL]
                     [source1] [source2 ...])
      

      context:
      i found this while working on qmake2cmake
      "def write_app_or_lib" wrongly calls qt_add_plugin with a sources argument
      qt_add_plugin silently ignores the sources

        Attachments

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

          Activity

            People

            Assignee:
            jbornema Joerg Bornemann
            Reporter:
            milahu milan hauth
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes