Hi, and welcome!
@Lopher said in Qt6.8 + CMake : <Unknown File>: No module named "IMClient" found:
I'm uncertain whether this is a sustainable solution and if it aligns with proper practices."
For the cleanest solution:
Use qt_standard_project_setup(REQUIRES 6.8) in your top-level CMakeLists.txt -- this automatically applies QTP0001 and QTP0004, so you don't need to set them manually
Don't set a custom RESOURCE_PREFIX
Don't call addImportPath()
Don't put your QML files on a specific place on disk -- let your app load it from the embedded resources instead
Give your main *.qml file a name that starts with an uppercase letter (so Login.qml, not login.qml)
Now, you can call engine.loadFromModule("IMClientQml", "Login");
Note: The whole point of introducing QTP0001 was to avoid the need for RESOURCE_PREFIX and addImportPath()
For further troubleshooting, call the following and inspect the output:
qDebug() << "Import paths:" << engine.importPaths();
qDebug("### Resources ###");
QDirIterator qrc(":", QDirIterator::Subdirectories);
while(qrc.hasNext())
qDebug() << qrc.next();