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

QT_QML_GENERATE_QMLLS_INI generates wrong buildDir

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.7.2, 6.8.0 FF, 6.8
    • 6.7
    • QML: Tooling
    • None
    • 5fdd8793c (dev), f58016227 (6.7)

    Description

      Consider the following CMake code:

      cmake_minimum_required(VERSION 3.16)
      
      project(untitled5 VERSION 0.1 LANGUAGES CXX)
      
      find_package(Qt6 6.5 REQUIRED COMPONENTS Quick)
      
      qt_standard_project_setup(REQUIRES 6.5)
      
      qt_add_executable(appuntitled5
          main.cpp
      )
      
      qt_add_qml_module(appuntitled5
          URI org.kde.foo
          VERSION 1.0
          QML_FILES Main.qml
      )
      
      target_link_libraries(appuntitled5
          PRIVATE Qt6::Quick
      ) 

       

      Building it with -DQT_QML_GENERATE_QMLLS_INI=ON generates the following .qmlls.ini file:

      [General]
      buildDir=/home/nico/build-untitled5-Qt_6_7-Debug/org/kde
      no-cmake-calls=false

       

      /home/nico/build-untitled5-Qt_6_7-Debug/org/kde contains the following files:

      /home/nico/build-untitled5-Qt_6_7-Debug/org/kde
      /home/nico/build-untitled5-Qt_6_7-Debug/org/kde/foo
      /home/nico/build-untitled5-Qt_6_7-Debug/org/kde/foo/appuntitled5_qml_module_dir_map.qrc
      /home/nico/build-untitled5-Qt_6_7-Debug/org/kde/foo/Main.qml
      /home/nico/build-untitled5-Qt_6_7-Debug/org/kde/foo/appuntitled5.qmltypes
      /home/nico/build-untitled5-Qt_6_7-Debug/org/kde/foo/qmldir
      

       

      When opening Main.qml in Kate with qmlls the org.kde.foo import is not found:

      Warning: /home/nico/untitled5/Main.qml:3:1: Warnings occurred while importing module "org.kde.foo": [import]
      ---
      Warning: Failed to import org.kde.foo. Are your import paths set up properly? [import]
      ---

       

      As far as I understand the generated file should contain

      buildDir=/home/nico/build-untitled5-Qt_6_7-Debug/

      instead. If I manually change it to that then qmlls finds the import.

      Tested with current Qt 6.7 branch (qtdeclarative 15ea39b5cb7a97d6ae19efe459885e9157b168e3)

      Attachments

        For Gerrit Dashboard: QTBUG-124521
        # Subject Branch Project Status CR V

        Activity

          People

            sami.shalayel Sami Shalayel
            nicolasfella Nicolas Fella
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes