'How to specify dependencies in qt_add_qml_module (CMake for Qt 6.2)
When using qt_add_qml_module
to specify a QML module, how do you handle Qt modules that it depends on (e.g. QtMultimedia)?
If I have class Synthesizer
that extends QML, but which has no dependencies, the following works fine:
qt_add_qml_module(Synth
URI Synth
VERSION 1.0
SOURCES
Synthesizer.h Synthesizer.cpp
)
target_include_directories(Synthplugin
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
)
target_link_libraries(myapp
PRIVATE Qt6::Quick
Synth
)
However if Synthesizer
uses QtMultimedia classes, then this is insufficient, and results in errors like:
Undefined symbols for architecture arm64:
"QAudioSink::start()", referenced from:
Synthesizer::start() in Synthesizer.cpp.o
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|