QtPlugins.cmake.in uses file(GENERATE) and target_sources() to
propagate the generated cpp files which contain plugin initialization
code to their consuming targets.
Unfortunately due to a bug in CMake, if the file is generated in a
different scope than the consuming target, the CMake generation
step will fail saying that the source file can not be found.
See https://gitlab.kitware.com/cmake/cmake/issues/18399 for details.
In the case of qtdeclarative, find_package(Qt6) is called at the top
level scope (this is when the file gets generated),
but the targets are created in subdirectory scopes, and the GENERATED
source file property is not propagated across scropes.
Circumvent the issue by instead using file(WRITE) and configure_file()
which create the file at configure time rather than generate time.
This will pollute the current binary directory with some more files,
but at least successfully fixes the build.
Change-Id: I3ab3b12dcbf6a9d0ab9ee87173e4a1952325b37b
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
Some work was needed to make the plug-in types,
and which plug-ins are available for each type
in client code.
Change-Id: Ib71feca31069deca3d3f54c8613054f5f8ae410c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
The build failed due to two different reasons.
We tried to assign properties on an aliased target, which does not
work. Make sure to set properties on the original unaliased target.
We tried to query for the value of the QT_DEFAULT_PLUGINS property
when automatically linking to plugins, but the generator expression
failed in the AND section, because querying for an unexisting value
does not return an integer, and the AND expression expects an integer.
The fix is to wrap the relevant expression in a BOOL generator
expression.
Change-Id: Ia065bc1de939cee49e5de0b2aef70e356cc5419a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Qt CMake Build Bot
This is done by adding a DEFAULT_IF argument to add_qt_plugin, which accepts
if-evaluated expressions.
e.g.
add_qt_plugin(myplugin
DEFAULT_IF ${foo} STREQUAL ${bar}
...
)
so that this mechanism can be reused later if necessary.
Change-Id: I7eba9adaaa28e55a4f0f94cf206e868b990027e6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>