Important: Please read the Qt Code of Conduct -

CMake Script to generate Q_IMPORT_PLUGIN to link against static Qt

  • Hi I would like to introduce to you a small CMake script a made in order to generate Q_IMPORT_PLUGIN macro when linking with static version of Qt. (For ios for example). This is a native feature of qmake but was missing with CMake build.
    This is composed of 2 macros, one to generate the *_plugin_import.cpp and the other to generate *_qml_plugin_import.cpp.
    I hope this will help some folks around, feel free to contribuate/test.

    Github :

    Ps: I Hope this is the good place to post.

  • Moderators

    nice, but if i may drop my input:

    you are importing most qml plugins. even when they aren't used. You can use the qmlimportscanner tool (located in the bin dir of the Qt installation) and parse the output. And only include the used plugins. (might require an additional script though)

  • This is already what I use to generate _qml_plugin_import.cpp so I only import required plugin. I have to admit that the other one _plugin_import.cpp generation il a little bit more brute Force and may break in the future

Log in to reply