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)
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
- relates to
-
QTBUG-100852 How to guides for working with CMake / transitioning from QMake
- Open
- resulted from
-
QTBUG-95207 Show error if qt_add_qml_module is called twice in the same directory scope
- Closed