Adding QML files to a CMake project

Well, it is able to show the QML files. You just need to add them to the project. Unfortunately our template doesn’t show you how to do that though. I’m not sure what’s the best way to do it, but at least this works:

file(GLOB_RECURSE QML_SRC "*.qml")
add_custom_target(qml_src SOURCES ${QML_SRC})

I don’t really recommend using GLOB_RECURSE though, it would probably be smarter to add each file separately.

4 Likes