"QML module not found" but application runs
Unsolved
QML and Qt Quick
-
I've created a module in a subdirectory as follows:
cmake_minimum_required(VERSION 3.16) project(superapp VERSION 0.1 LANGUAGES CXX) set(CMAKE_AUTOMOC ON) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6 6.2 COMPONENTS Gui Quick Multimedia REQUIRED) qt_add_executable(appsuperapp main.cpp ) qt_add_qml_module(appsuperapp URI Superapp VERSION 1.0 RESOURCE_PREFIX /scythestudio.com/imports QML_FILES main.qml Pages/Page.qml ) add_subdirectory(Test/MyComp) set_target_properties(appsuperapp PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE TRUE WIN32_EXECUTABLE TRUE ) target_link_libraries(appsuperapp PRIVATE Qt6::Gui Qt6::Quick Qt6::Multimedia MyCompLibplugin) install(TARGETS appsuperapp BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
qt_add_library(MyCompLib STATIC) set_target_properties(MyCompLib PROPERTIES AUTOMOC ON) target_link_libraries(MyCompLib PRIVATE Qt6::Quick) list(APPEND MODULE_QML_FILES MyButton.qml) qt_add_qml_module(MyCompLib URI MyComp VERSION 1.0 QML_FILES ${MODULE_QML_FILES} )
The application runs fine and I'm able to use import MyComp and use MyButton. However, QtCreator shows "QML module not found" next to the import and I'm not getting code completion or highlighting on MyButton:
Is this something I can safely ignore? Is there anything I can do to help QtCreator find the module?