CMake: Let qt6_add_plugin accept sources
The commands qt6_add_executable and qt6_add_library both accept a list of sources that get automatically added to the created target. Extend qt6_add_plugin to also accept sources for consistency. Fixes: QTBUG-104189 Change-Id: Iad5d8c5b31551663be155d068d55e770e1a91b27 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
c155734bfc
commit
7ce82225f6
@ -1,8 +1,5 @@
|
|||||||
qt_add_plugin(echoplugin
|
qt_add_plugin(echoplugin
|
||||||
CLASS_NAME EchoPlugin
|
CLASS_NAME EchoPlugin
|
||||||
)
|
|
||||||
|
|
||||||
target_sources(echoplugin PRIVATE
|
|
||||||
echoplugin.cpp echoplugin.h
|
echoplugin.cpp echoplugin.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
qt_add_plugin(pnp_basictools
|
qt_add_plugin(pnp_basictools
|
||||||
STATIC
|
STATIC
|
||||||
CLASS_NAME BasicToolsPlugin
|
CLASS_NAME BasicToolsPlugin
|
||||||
)
|
|
||||||
|
|
||||||
target_sources(pnp_basictools PRIVATE
|
|
||||||
basictoolsplugin.cpp basictoolsplugin.h
|
basictoolsplugin.cpp basictoolsplugin.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
qt_add_plugin(pnp_extrafilters
|
qt_add_plugin(pnp_extrafilters
|
||||||
CLASS_NAME ExtraFiltersPlugin
|
CLASS_NAME ExtraFiltersPlugin
|
||||||
)
|
|
||||||
|
|
||||||
target_sources(pnp_extrafilters PRIVATE
|
|
||||||
extrafiltersplugin.cpp extrafiltersplugin.h
|
extrafiltersplugin.cpp extrafiltersplugin.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
qt_add_plugin(simplestyleplugin
|
qt_add_plugin(simplestyleplugin
|
||||||
CLASS_NAME SimpleStylePlugin
|
CLASS_NAME SimpleStylePlugin
|
||||||
)
|
|
||||||
|
|
||||||
target_sources(simplestyleplugin PRIVATE
|
|
||||||
simplestyle.cpp simplestyle.h
|
simplestyle.cpp simplestyle.h
|
||||||
simplestyleplugin.cpp simplestyleplugin.h
|
simplestyleplugin.cpp simplestyleplugin.h
|
||||||
)
|
)
|
||||||
|
@ -2328,7 +2328,7 @@ function(qt6_add_plugin target)
|
|||||||
set(type_to_create MODULE)
|
set(type_to_create MODULE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
_qt_internal_add_library(${target} ${type_to_create})
|
_qt_internal_add_library(${target} ${type_to_create} ${arg_UNPARSED_ARGUMENTS})
|
||||||
|
|
||||||
get_target_property(target_type "${target}" TYPE)
|
get_target_property(target_type "${target}" TYPE)
|
||||||
if (target_type STREQUAL "STATIC_LIBRARY")
|
if (target_type STREQUAL "STATIC_LIBRARY")
|
||||||
|
@ -21,6 +21,7 @@ qt_add_plugin(target
|
|||||||
[SHARED | STATIC]
|
[SHARED | STATIC]
|
||||||
[CLASS_NAME class_name]
|
[CLASS_NAME class_name]
|
||||||
[OUTPUT_TARGETS variable_name]
|
[OUTPUT_TARGETS variable_name]
|
||||||
|
sources...
|
||||||
)
|
)
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
@ -37,6 +38,9 @@ By default, the plugin will be created as a \c STATIC library if Qt was built
|
|||||||
statically, or as a \c MODULE library otherwise. You can override this default
|
statically, or as a \c MODULE library otherwise. You can override this default
|
||||||
by explicitly providing the \c STATIC or \c SHARED option.
|
by explicitly providing the \c STATIC or \c SHARED option.
|
||||||
|
|
||||||
|
Any \c{sources} provided will be passed through to the internal call to
|
||||||
|
\c{add_library()}.
|
||||||
|
|
||||||
\note Non-static plugins are meant to be loaded dynamically at runtime, not
|
\note Non-static plugins are meant to be loaded dynamically at runtime, not
|
||||||
linked to at build time. CMake differentiates between these two scenarios by
|
linked to at build time. CMake differentiates between these two scenarios by
|
||||||
providing the \c MODULE library type for dynamically loaded libraries, and
|
providing the \c MODULE library type for dynamically loaded libraries, and
|
||||||
|
Loading…
Reference in New Issue
Block a user