qt_ifcodegen_extend_target

Synopsis

qt_ifcodegen_extend_target(
    target
    IDL_FILES idl_files
    TEMPLATE template
    [ANNOTATION_FILES ...]
    [IMPORT_PATH ...]
    [OUTPUT_DIR output_dir]
    [EXTRA_HEADERS_OUTPUT_DIR extra_headers_output_dir]
    [EXTRA_TEMPLATE_SEARCH_PATH ...]
    [VERBOSE]
    [NO_GENERATE]
)

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

Description

Extends a target with files generated from a qface IDL file by invoking ifcodegen. How the target is extended is defined by the template and the generated CMake file.

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.

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 headers 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.

Using NO_GENERATE it is possible to skip calling ifcodegen. This is usually only needed if you are sure the files are already generated e.g. by using qt_ifcodegen_generate before.

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

Examples

find_package(Qt6 COMPONENTS InterfaceFramework)

qt6_add_library(AdressBook)

# Generate code and extend the AddressBook target
# with the generated files
qt6_ifcodegen_extend_target(AdressBook
    IDL_FILES addressbook.qface
    TEMPLATE frontend
)

target_link_libraries(AdressBook PUBLIC
    Qt::Core
    Qt::InterfaceFramework
    Qt::InterfaceFrameworkPrivate
    Qt::Qml
    Qt::Quick
)

© 2021 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.