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

_qt_internal_collect_buildsystem_targets does not handle multiple build directories of the same source directory

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5.4, 6.6.1, 6.7.0 Beta1
    • Build System: CMake
    • None
    • 67b7b51e8 (dev), 24befe64f (6.7)

    Description

      qt_examples_build_end() calls _qt_internal_collect_buildsystem_targets() to then call qt_autogen_tools() on the collected targets.

      For source directories that have been added via add_subdirectory() multiple times with different binary directories, _qt_internal_collect_buildsystem_targets will not collect targets from the latter calls of add_subdirectory, but only the first one.

      This is relevant for qtdeclarative/examples/quick/CMakeLists.txt where each example does

      add_subdirectory("../../quick/shared" "shared")
      

      Because of that, each time a new example is aded that uses the shared bits, we need to manually ensure to call qt_autogen_tools(${example_name}_shared).

      People tend to forget to do that (myself included), and we discover this only during failed qt5.git integrations, because the issue only manifests in top-level builds with an error like:

      CMake Error: AUTOMOC for target weatherforecast_shared: The "moc" executable "/Users/qt/work/qt/qt5/qtbase/libexec/moc" does not exist.
      

      This was handled pragmatically by adding each shared target manually, but we should try to automate this instead.

      If SUBDIRECTORIES property in _qt_internal_collect_buildsystem_targets does not give us the full list of build directories, maybe we should just use another custom property to collect the extra build directories.

      See also the following comment that originally described the issue (point 2)

      https://bugreports.qt.io/browse/QTBUG-96159?focusedId=582160&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-582160

      Attachments

        Issue Links

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

          Activity

            People

              qtbuildsystem Qt Build System Team
              alexandru.croitor Alexandru Croitor
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes