qt_ifcodegen_add_qml_module

Adds a QML module which is generated by ifcodegen using a qface IDL file.

The command is defined in the InterfaceFramework component of the Qt6 package.

Load the package with:

find_package(Qt6 REQUIRED COMPONENTS InterfaceFramework)

This command was introduced in Qt 6.8.

Synopsis

qt_ifcodegen_add_qml_module(
    target
    IDL_FILES idl_files
    TEMPLATE template
    [ANNOTATION_FILES ...]
    [IDL_IMPORT_PATH ...]
    [OUTPUT_DIR output_dir]
    [EXTRA_HEADERS_OUTPUT_DIR extra_headers_output_dir]
    [EXTRA_TEMPLATE_SEARCH_PATH ...]
    [VERBOSE]
    [...] # arguments supported by qt_add_qml_module
)

If versionless commands are disabled, use qt6_ifcodegen_add_qml_module() instead. It supports the same set of arguments as this command.

Description

Adds a QML module which is generated by ifcodegen.

It accepts the following arguments in addition to all arguments supported by qt6_add_qml_module.

The URI and VERSION arguments are automatically extracted from the template file if not set explicitly. The module OUTPUT_DIRECTORY is set to URI with dots replaced by forward slashes unless you set it explicitly.

The input IDL file is specified using IDL_FILES, while TEMPLATE specifies the ifcodegen template used for the generation. The given template either needs to be a path to a template folder or a name of a template found in the template search path. Using the EXTRA_TEMPLATE_SEARCH_PATH argument, it is possible to extend the search path. This is especially useful if you want to use your own templates for the code generation. As an alternative to the function argument the QT_IFCODEGEN_TEMPLATE_SEARCH_PATH global CMake variable can be used to specify an extra search path for all ifcodegen function calls.

Additional annotation files are passed by the ANNOTATION_FILES argument.

IDL_IMPORT_PATH can be used to add to the search paths where IDL files that this one depends on can be found. The other IDL files still need to be generated and built on their own.

OUTPUT_DIR specifies the directory where the generated files will be written to and defaults to CMAKE_CURRENT_BINARY_DIR.

EXTRA_HEADER_OUTPUT_DIR is used to provide an extra directory where all generated header files are copied to.

By default all log messages generated by ifcodegen are discarded. To show them you can use the VERBOSE argument, set the IFCODEGEN_VERBOSE variable or use set CMAKE_MESSAGE_LOG_LEVEL to VERBOSE.

For more details on the generator's command line arguments, see Use the Generator.

For more details on the generator's command line arguments, see Use the Generator.

Examples

find_package(Qt6 COMPONENTS InterfaceFramework)

# Generates code using the frontend template
# and registers the library as a QML module
# The NO_PLUGIN_OPTIONAL option is passed directly
# to qt_add_qml_module.
qt_add_qml_module(addressbook
    IDL_FILES addressbook.qface
    TEMPLATE frontend
    NO_PLUGIN_OPTIONAL
)

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.