If you have nix installed compile and run with:
$ nix build
$ ./result/bin/demo
Explaination: we load the .qml file with qrc:///main.qml: it uses for that the file qml.qrc (the name is not important) that lists the resource files. This 'qml.qrc file is then given to qt5_add_resources(…) in CMakeLists.txt in order to compile the resources and include them in the final binary. Note that resources must be compiled: other methods involve qmake or a manual compilation.