Adds QML source files to a target.


qul_target_qml_sources(<target> src_file1 [src_file2 ...]
                       [OUTPUT_DIRECTORY <directory>]
                       [MODULE_URI <uri>]


Creates rules for calling the QML to C++ compiler (qmltocpp) on the given source .qml files. For each input file, an output file is generated in a subfolder under the build directory. These generated files are listed as source files of the target.


You can set the OUTPUT_DIRECTORY explicitly to control where the generated files are placed. If the path is relative, it is relative to the current build directory.

When building a library that provides a QML module, use the optional MODULE_URI parameter to ensure that the generated sources use the appropriate namespace. The uri is a normal dot-separated QML import uri.

Set the COPY_QML_FILES flag for the source .qml files to be copied next to the generated files. This can be useful for building QML modules.


qul_target_qml_sources(example_app Example.qml MyButton.qml)
qul_target_qml_sources(example_lib IndicatorBase.qml Style.qml
                       MODULE_URI MyModule.Indicators
                       OUTPUT_DIRECTORY MyModule/Indicators


This command was introduced in Qt Quick Ultralite 1.0.

See also qmltocpp.

Available under certain Qt licenses.
Find out more.