qt_ifcodegen_import_variables
Generates files from a qface IDL file and provides variables for use within CMake.
The command is defined in the InterfaceFramework
component of the Qt6
package.
Load the package with:
find_package(Qt6 REQUIRED COMPONENTS InterfaceFramework)
Synopsis
qt_ifcodegen_import_variables( prefix 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] [NO_GENERATE] )
If versionless commands are disabled, use qt6_ifcodegen_import_variables()
instead. It supports the same set of arguments as this command.
Description
Generates files from a qface IDL file by invoking ifcodegen. All generated files are provided by exposing variables to the current scope. All exposed variables start with the prefix
followed by a underscore and are defined by the referenced template.
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.
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) # Generate code and import variables into the # current scope. The variables start with BOOK. qt6_ifcodegen_import_variables(BOOK IDL_FILES addressbook.qface TEMPLATE frontend ) # Use the import variables to build the module qt_add_qml_module(addressbook_plugin OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${BOOK_URI_PATH}" URI ${BOOK_URI} VERSION ${BOOK_VERSION} PLUGIN_TARGET addressbook_plugin NO_PLUGIN_OPTIONAL NO_GENERATE_PLUGIN_SOURCE SOURCES ${BOOK_SOURCES} ) target_link_libraries(AdressBook PUBLIC Qt::Core Qt::InterfaceFramework Qt::InterfaceFrameworkPrivate Qt::Qml Qt::Quick )
© 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.