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