Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.8.0
-
None
Description
If you do something wrong with IMPORTS in qt_add_qml_module, currently it doesn't give you any error, not even a warning at CMake configure time, but it will silently fail behind the scene, and you'll get errors at runtime.
The reproducible steps are too basic to require pasting the full sources here. Open Qt Creator and create a new Qt Quick C++ application. Make sure your hello world program runs. Then open CMakeLists.txt and append IMPORTS InvalidName to qt_add_qml_module and rebuild the project and try to run again, it will fail at runtime with error with no hint of invalid imports at all:
QQmlApplicationEngine failed to load component
<Unknown File>: No module named "new_qt_app" found
The issue should have been detected at CMake configure time, it actually took me some time to figure out that the issue was in CMakeLists.txt. The issue isn't limited to just IMPORTS but also DEPENDENCIES, the only difference is that with a invalid dependency you still get to run the program, but the dependency just isn't there.