qt_wrap_ui

Creates sources for .ui files.

The command is defined in the Widgets component of the Qt6 package. Load the package with:

 find_package(Qt6 REQUIRED COMPONENTS Widgets)

Synopsis

 qt_wrap_ui(<VAR> ui_file1 [ui_file2 ...]
            [OPTIONS ...])

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

Description

Creates rules for calling the User Interface Compiler (uic) on the given .ui files. For each input file, an header file is generated in the build directory. The paths of the generated header files are added to <VAR>.

Note: This is a low-level macro. See the CMake AUTOUIC Documentation for a more convenient way to process .ui files with uic.

Since 6.8:

Note: qt_add_ui is the recommended way to process .ui files.

Options

You can set additional OPTIONS that should be added to the uic calls. You can find possible options in the uic documentation.

Examples

 set(SOURCES mainwindow.cpp main.cpp)
 qt_wrap_ui(SOURCES mainwindow.ui)
 qt_add_executable(myapp ${SOURCES})