Use the qmlprojectexporter to export the QML sources, image assets and fonts into compilable c++ code. It parses a .qmlproject file listing the assets with exporting options, and converts them. In addition, qmlprojectexporter also exports plain-text lists of the imported and exported files, for convenient automatic use by a 3rd party build system, such as CMake.

Usage of qmlprojectexporter in a CMake project

Using qmlprojectexporter with a CMake build system is straightforward and the custom CMake macro qul_add_target already takes care of calling qmlprojectexporter with the right parameters, and it requires defining the "QML_PROJECT" argument followed by a qmlproject file as shown next.

qul_add_target(my_project QML_PROJECT my_project.qmlproject)

When using qmlprojectexporter, the following CMake macros are not needed as calling qmlprojectexporter implies the same logic:

Also setting the following target properties from CMake is not required


Note for a working Qul application with CMake it is still required to call app_target_setup_os and app_target_default_entrypoint macros after adding the qmlproject target as shown next.

// With a \c Main.qml (specified only as Main) being the entrypoint
app_target_default_entrypoint(swipe_game_qmlproject Main)

Using standalone qmlprojectexporter

When using a build system other than CMake it is still possible to use qmlprojectexporter directly. It generates the asset files, which you could use with a build system of your choice.

qmlprojectexporter --outdir output_directory myproject.qmlproject

Note: Look at the QmlProject reference for the extended list of qmlprojectexporter command-line options


This executable was introduced in QmlProject API 1.3.

Available under certain Qt licenses.
Find out more.