Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
6.6.1
-
Windows, Linux
Description
Hello,
static module linking for QML modules declared using the new CMake API is inconsistent between Linux (Manjaro) and Windows. Here is the overview:
I have a project with the following structure:
Project
+-- CMakeLists.txt (root)
+-- main.cpp
+-- example
+-- CMakeLists.txt (child)
+-- main.qml
Root CMakeLists defines a new executable using qt_add_executable. Child CMakeLists defines a QML module with qt_add_qml_module on target QmlModule. The executable is linked to the QmlModule target.
On Linux, this project works as expected - calling QQmlApplicationEngine::load("qrc:/example/main.qml") launches the GUI correctly.
On Windows, the project compiles, but fails at runtime with the following error:
qrc:/example/main.qml: No such file or directory
The official documentation gives an example linking not to the module target, but to the autogenerated plugin (link). This approach works on both platforms.
I don't know which platform displays the correct behavior, but I think it should be consistent.
I have attached a MRE project to test this issue.
Attachments
Issue Links
- duplicates
-
QTBUG-95149 Fix use case of linking an executable to a shared library QML module backing target
- Reported