Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-102632

cmake/qml type compiler: AutoMoc error when backing target is unity built

    XMLWordPrintable

Details

    Description

      i've been experimenting with the qml type compiler, trying to integrate it into cmake. i'm using statically linked qt and build the qml module (and plugin) as static libraries:

      something like:

      add_library(MyModule STATIC ...)
      
      qt_add_qml_module(
          MyModule
          PLUGIN_TARGET MyPlugin
          )
      
      qt6_target_compile_qml_to_cpp(MyModule ...)
      

      this gives me an automoc error, because `MyModule_autogen/timestamp` depends on headers, which are generated by qmltc. this seems to be an issue on clean rebuilds, as i've mainly seen this on clean buildserver builds.

      i can obviously work around this by not using my static library as backing target for the module:

      add_library(MyLib STATIC ...)
      
      qt_add_qml_module(
          MyModule
          PLUGIN_TARGET MyModule
          )
      
      qt6_target_compile_qml_to_cpp(MyModule ...)
      target_link_libraries(MyLib PUBLIC MyModule)
      

      but i wonder if there is a way to catch this error early (e.g. raise a cmake error in qt6_target_compile_qml_to_cpp when the backing target is a separate static library)

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            agolubev Andrei Golubev
            timblechmann tim blechmann
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes