diff options
| author | Dominik Holland <dominik.holland@qt.io> | 2021-09-08 17:10:51 +0200 |
|---|---|---|
| committer | Dominik Holland <dominik.holland@qt.io> | 2021-09-15 16:55:48 +0200 |
| commit | 9e16c8d6174a7fa5cc1b94a03badbc6862e5e794 (patch) | |
| tree | 4d767eb108423b4859b9f21e966d72df0a5e903d /src/interfaceframework/doc/snippets | |
| parent | 0f73a927f5237efb0ac96faa618c6bff9347fffa (diff) | |
Add documentation for the ifcodegen cmake API
Pick-to: 6.2
Change-Id: Ib35aeb1d3ec85ed1694e598795cd5c28c8eb696c
Reviewed-by: Robert Griebl <robert.griebl@qt.io>
Diffstat (limited to 'src/interfaceframework/doc/snippets')
| -rw-r--r-- | src/interfaceframework/doc/snippets/cmake-macros/CMakeLists.txt | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/interfaceframework/doc/snippets/cmake-macros/CMakeLists.txt b/src/interfaceframework/doc/snippets/cmake-macros/CMakeLists.txt new file mode 100644 index 00000000..fa858714 --- /dev/null +++ b/src/interfaceframework/doc/snippets/cmake-macros/CMakeLists.txt @@ -0,0 +1,51 @@ +#! [ifcodegen_extend_target] +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 +) +#! [ifcodegen_extend_target] + +#! [ifcodegen_import_variables] +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 +) +#! [ifcodegen_import_variables] |
