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

OUTPUT_TARGETS not fully supported in qt6_add_resources

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.8.5, 6.9.3, 6.10.0
    • Build System: CMake
    • None
    • Visual Studio 2022

    • All

      qt6_add_resource has an optional variable OUTPUT_TARGETS, which is supposed to be set to the list of special targets.

      From the documentation "When using this command with static libraries, one or more special targets will be generated. Should you wish to perform additional processing on these targets, pass a variable name to the OUTPUT_TARGETS parameter. The qt_add_resources function stores the names of the special targets in the specified variable."

      However, not all special targets are added.  the ide_target set in _qt_internal_expose_source_file_to_ide does not get applied to this variable.

      The solution I propose is the following.

      • add a variable to _qt_internal_expose_source_file_to_ide to be set to the ide_target
      • Append this value to the variable output_targets in _qt_internal_process_resource

      I have attached this fix to Qt6CoreMacros.cmake

      On a second note, ALL the qt6_XXX functions supplied that create special targets SHOULD support this flow, qt6_add_executable does not and it creates a _qmlimportscan target.

      Unfortunately the target does not get created after qt6_add_executable is called, it occurs sometime later, during qt_finalize_target.  So the only way to use the special target is to call add_executable with MANUAL_FINALIZE, then call qt_finalize_target and then use the special target

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

            qtbuildsystem Qt Build System Team
            scottbloom Scott
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes