summaryrefslogtreecommitdiffstats
path: root/cmake/QtPlugins.cmake.in
Commit message (Collapse)AuthorAgeFilesLines
* Remove unnecessary $<BOOL:...> generator expressionCraig Scott2021-03-221-4/+1
| | | | | | | | | | The $<NOT:...> genex already guarantees to return a value of 0 or 1, so there's no need to wrap it with $<BOOL:...>. Change-Id: Iff4ad64ed8deaa846e1b5bc22d2e5d9dbcd77cc7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit df121fd7f74ecfb3de20867edea1c1f3ebf035c2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Prevent static plugin triggering autogen dependency on reconfigureCraig Scott2021-03-181-7/+15
| | | | | | | | | | | | | | | | | | | | | A call to file(WRITE) will unconditionally update the file's timestamp even if the file's contents don't change. The *Plugin.cpp file was being written using configure_file() which avoids that, but the .cpp.in file it was configuring from was being written out using file(WRITE) every time CMake ran. Autogen saw that file as a dependency and then regenerated the mocs_compilation.cpp file, which in turn results in unnecessary rebuilds and relinking when nothing is actually changing. The file(WRITE) - configure_file() dance is no longer needed anyway, since the generated *Plugin.cpp file is very simple with no substitutions required. Therefore, we can simplify that file's generation with a single file(WRITE) that only executes if the file contents will change or the file is missing. Change-Id: I2b7d1ff678b85ea7811969d656555592c9b6865f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 63a0d263cf233ddf85a60678829298b50e8d1f26) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* CMake: Fix prl files of static Qt buildsAlexandru Croitor2020-08-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Static Qt plugins should not be included in the list of libraries of a prl file. They end up being there due to our circular dependency trick where the plugins depend on the module they belong to. This in turn causes the giant static plugin generator expressions to be processed in qt_collect_libs(), and the generated prl file ends up having target names like Qt6::QJpegPlugin which are obviously not linker flags. To eliminate the static plugins from prl files, add an additional dummy boolean generator expression '$<BOOL:QT_IS_PLUGIN_GENEX>' that always evaluates to true. We can string match on this expression in qt_collect_libs, and thus remove the whole static plugin genex entry. This should fix linking of apps with qmake that use a CMake-built static Qt. Task-number: QTBUG-85865 Task-number: QTBUG-85240 Task-number: QTBUG-85801 Change-Id: I949dc5edb10d94c4ab84ed430af7c164d8efaaa6 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Fix qt_import_plugins compatibility with Qt 5Alexandru Croitor2020-01-271-1/+18
| | | | | | | | | | Handle versionless plugin names passed to qt_import_plugins. Task-number: QTBUG-74137 Task-number: QTBUG-80477 Change-Id: Ic7fb6e54d2822c7eb58a7874b4a1c137f0c101d9 Reviewed-by: Qt CMake Build Bot Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Fix Generator Expression for static non-prefix buildsLeander Beernaert2020-01-101-1/+1
| | | | | Change-Id: Icd32164943d7bb0639de3022bae749d0010674fc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement qtbase fixes for superbuildsJean-Michaël Celerier2020-01-081-7/+24
| | | | | | Change-Id: I0d3445cf0740e3925fa9342dac4d07892518afe5 Reviewed-by: Qt CMake Build Bot Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Fix automatic plugin importing in static buildsAlexandru Croitor2019-10-091-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Match qt_import_plugin API with qt5'sJean-Michaël Celerier2019-10-091-10/+49
| | | | | | | | | | 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
* Fix building examples when doing a Qt static buildAlexandru Croitor2019-07-221-1/+11
| | | | | | | | | | | | | | | | | | 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
* cmake: implement default qpa plugin behavior for static buildsJean-Michaël Celerier2019-07-051-8/+8
| | | | | | | | | | | | | | | | | 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>
* cmake: allow client apps to load static plug-insJean-Michaël Celerier2019-07-051-0/+40
Based in part on Kyle Edwards's implementation : https://codereview.qt-project.org/c/qt/qtbase/+/243731 Example : ``` cmake_minimum_required(VERSION 3.15) project(foo) add_executable(foo main.cpp) find_package(ICU COMPONENTS i18n uc data REQUIRED) find_package(Qt6 COMPONENTS Core Gui REQUIRED) target_link_libraries(foo Qt6::Core Qt6::Gui) qt_import_plugins(foo INCLUDE Qt6::qxcb EXCLUDE Qt6::qgtk3 Qt6::qeglfs-kms-integration Qt6::qjpeg ) ``` Change-Id: If7736c42f669f7d7f43052cae59c28fc7fcb4156 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>