Details
-
Suggestion
-
Resolution: Done
-
P2: Important
-
None
-
None
-
7ce82225f6 (qt/qtbase/dev) 7ce82225f6 (qt/tqtc-qtbase/dev), 2706f8c78 (6.4), ae3224bf9 (dev), 60edcceb4 (tqtc/lts-6.2)
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
For Gerrit Dashboard: QTBUG-104189 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
418136,2 | CMake: Let qt6_add_plugin accept sources | dev | qt/qtbase | Status: MERGED | +2 | 0 |
419367,2 | Fix qt_add_plugin calls for Qt < 6.5 | dev | qt/qmake2cmake | Status: MERGED | +2 | 0 |
448053,3 | CMake: Warn about additional arguments to qt_add_plugin() | 6.4 | qt/qtbase | Status: MERGED | +2 | 0 |
448054,4 | Document the qt_add_plugin() options new in Qt 6.5 as such | dev | qt/qtbase | Status: MERGED | +2 | 0 |
448196,2 | CMake: Warn about additional arguments to qt_add_plugin() | tqtc/lts-6.2 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |