Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
6.2.0, 6.2.3
Description
QML module containing the main.qml is not loaded automatically when QML module is created using the new QML CMake API in a subdirectory using: add_subdirectory() and the created module (mainQml in the example) is linked with the app by using:
target_link_libraries(appCmakeTest
PRIVATE Qt6::Quick
mainQml
)
According to build logs necessary files are passed to linker but this linking seems to be optimized away on Windows (but not on other systems).
Way to reproduce:
On Windows, build and run the attached example project with Qt 6.2.3.
Application crashes and in application output it says:
"QQmlApplicationEngine failed to load component
qrc:/mainQml/main.qml: No such file or directory"
Expected behavior would be that module is loaded automatically and in the application "Works Ok" text is visible.
Linker can be "fooled" by adding some symbol from the mainQml which results the plugin to be loaded on startup like intended.
Manually loading the plugin can be used as a workaround on Windows with such approach.
Attachments
Issue Links
- duplicates
-
QTBUG-95149 Fix use case of linking an executable to a shared library QML module backing target
- Reported