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

Generating projects for 3rd party IDEs

To simplify Qt for MCUs project integration either with a workflow using the GHS Multi IDE or other build systems, qmlprojectexporter can export project files containing the generated UI sources together with exported platform sources for the targeted platform.

Trigger this feature by specifying the project type and platform target using the --project-type, --platform, and --toolchain command-line arguments.

For more information about this feature, refer to Exporting a Qt for MCUs project with platform sources


This executable was introduced in QmlProject API 1.3.

Available under certain Qt licenses.
Find out more.