C

qul_add_target

Creates a Qt Quick Ultralite application target and links to the Qt Quick Ultralite libraries.

Synopsis

qul_add_target(<name>
               [STATIC_LIBRARY]
               [GENERATE_ENTRYPOINT]
               [QML_PROJECT <qmlproject_file>]
               [SELECTORS <selectors...>]
               [source1]
               [source2 ...])

Description

Creates a Qt Quick Ultralite application target and automatically links it to the Qt Quick Ultralite Core library. Depending on the options provided, it could either produce an executable or a static library.

Note: qul_add_target replaces add_executable in all Qt Quick Ultralite demos and examples to produce a static library more easily. It is recommended to use it in all new projects that are built against Qt for MCUs version 1.8 and later.

Options

The optional STATIC_LIBRARY flag specifies that the output artifact is a static library.

The optional GENERATE_ENTRYPOINT flag specifies that a default entrypoint to the application will be generated from a Qml file defined using Project.mainFile, making the latter a required property in the QmlProject file if GENERATE_ENTRYPOINT is used. An entrypoint refers most importantly to main.cpp if the application is executable or qul_run.h if the target is marked as a static library using STATIC_LIBRARY defined above. if this flag is not specified a custom entrypoint should be added to the project as a source in qul_add_target or using cmake's add_sources command See Qul::Application for details on how to configure a custom entrypoint.

The QML_PROJECT needs to be specified when the project is configured using a qmlproject file. It requires a qmlproject file to be specified.

SELECTORS is a multi-value arguments that allows you to configure which files are to be picked from the different variants present in the project file structure. It provide an alternative to MCU.Config.fileSelector where the selectors defined with SELECTORS apply to all qmlproject files used in the project.

Note: SELECTORS are meant to be used only if the QML_PROJECT is specified.

Examples

qul_add_target(example_app)
qul_add_target(example_app STATIC_LIBRARY)
qul_add_target(example_app
               source1.cpp
               source2.cpp)
qul_add_target(example_app
               STATIC_LIBRARY
               source1.cpp
               source2.cpp)
//Configure a Qul project using qmlproject files
qul_add_target(example_app
            QML_PROJECT
            example_app.qmlproject
)
// Configure which variant of the project to apply using selectors
qul_add_target(example_app
            QML_PROJECT
            example_app.qmlproject
            SELECTORS
                small_screen board_id ram_optimized
)

Since

This command was introduced in Qt Quick Ultralite 1.7.

See also qmltocpp.

Available under certain Qt licenses.
Find out more.