'Qt6 CMake for QML

I'm working on Qt with CMake. Is it possible to import runtime QML files using CMake?

I wanto to creare a folder, near the .exe where I can put many QML files.

MyProject

  • CMakeLists.txt
  • main.cpp
  • main.qml test_comp myComponent
  • CMakeLists.txt
  • FirstComponent.qml
  • SecondComponent.qml

First CMakeLists.txt [...] add_subdirectory(test_comp/myComponent) [...]

MyComponent CMakeLists.txt qt_add_qml_module(myComponent URI test_comp.myComponent VERSION 1.0 PLUGIN_TARGET myComponent QML_FILES TabButton.qml )

With this solution Qt create .dll and .lib files. but If I want to modify my component.qml I need to rebuild to generate new dll. and .lib files.

Is there a way with CMake to make that qml component workable runtime for my app?

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source