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

qt_add_qml_module default value for OUTPUT_DIRECTORY creates conflicts

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.2.2
    • None
    • MacBook Pro (M1), macOS 12.1, Apple Clang 13.0.0 (clang-1300.0.29.30)
    • macOS

    Description

      If you have qt_add_qml_module() 2 or more times and OUTPUT_DIRECTORY is not specified then you get an error when running CMake.

      e.g.
       

      qt_add_qml_module(CommonAnimals
          URI CommonAnimals
          VERSION 1.0
          SOURCES
              Animal.h Animal.cpp
              Mammal.h Mammal.cpp
              AlsoUsesAnimal.h AlsoUsesAnimal.cpp
              Swimming.h Swimming.cpp
      )
      
      qt_add_qml_module(Bird
          URI Bird
          VERSION 1.0
          SOURCES
              Penguin.h Penguin.cpp
      )
      

      fails to configure with the error:
       

      CMake Error at /Users/paul.masristone/Qt/6.2.3/macos/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:305 (message):
        Output directory for target "Bird" is already used by another QML module
        (target "CommonAnimals").  Output directory is:
      
          /Users/paul.masristone/Code/build-Silly-Qt_6_2_3_for_macOS-Debug
      

       

      Looking through the code in Qt6QmlMacros.cmake, I see that if OUTPUT_DIRECTORY is not provided, the default is the build root.

      My suggestion to solve this issue is for the default to be changed to build-root/backing-target.

      i.e. equivalent to me explicitly putting OUTPUT_DIRECTORY CommonAnimals and OUTPUT_DIRECTORY Bird respectively in my example above.

      This would avoid directory clashes. I have been able to configure and build using this but there may be other side-effects I haven't considered.

      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
              paulmasri Paul
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes