Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-131321

qt_add_qml_module should not silently fail when there are invalid imports

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8.0
    • None
    • Windows

    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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtbuildsystem Qt Build System Team
            jclink Jessia Clinkscale
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes