Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for MCUs
  4. How to consume public header files of a generic qml_module in a project specific qml_module

How to consume public header files of a generic qml_module in a project specific qml_module

Scheduled Pinned Locked Moved Unsolved Qt for MCUs
1 Posts 1 Posters 41 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andreas Schacherbauer
    wrote 21 days ago last edited by
    #1

    Hi!
    We have a bit more complex setup with a generic library that defines (multiple) qml_modules. These qml_modules are then consumed in projects. Projects are again separated into multiple qml_modules. The problem arises while we wanted to transition to QmlProject files from CMake (as the Qt for MCUs CMake API is deprecated). The project specific qml_module has C++ types that need to be used in Qml, hence we define a InterfaceFiles node in the QmlProject like the following:

        InterfaceFiles {
            files: [
                "include/path/to/a/InterfaceHeader.h"
            ]
            MCU.qmlImports: [
                "com.company.generic.component"
            ]
        }
    

    The compiler fails to resolve header includes in InterfaceHeader.h as the qmlprojectgenerator only gets CMake INCLUDE_DIRECTORIES of the CMake targets of the project feature qml_module passed as the --include-dirs parameter. The feature lib (created with qul_add_target(TARGET_NAME QML_PROJECT feature.qmlproject) does link to the generic qml_module with a target_link_libraries() call but this is too late for the internal workings of the qul_add_target macro.

    Somehow the QmlProject is missing a way to tell it which other qml_modules need to be linked/considered. The qul_add_target macro at some point internally is only evaluating the direct INCLUDE_DIRECTORIES which does not include the include directories of transitive dependencies.

    Here is another short overview of the structure:

    * generic-library
        - output: qml_module
    
    * project
        * feature-a
            - defines qml_module
                - depends on qml_module of generic-library
                - ERROR: the interface header files of this of this qml_module are unable to include headers of the generic-library when using .qmlproject files. 
        * feature-xxx
            - defines qml_module
                - depends on qml_module of generic-library
                - additionally might depend on another feature of the project
        * project-lib
            - depends on all features 
        * project-app
            - depends on project-lib
    

    Thx,
    Andi

    1 Reply Last reply
    0

    1/1

    25 Apr 2025, 13:46

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved