Unsolved QtQuick Compiler in CMake
-
Hi,
I put my QML files into a separate qrc/rcc file in a cmake projekt:
qt5_add_binary_resources("res" "qml.qrc" DESTINATION "qml.rcc")
This works fine so far. Now I wanted to precompile them. According to this I only need to change
qt5_add_resources(RESOURCES example.qrc) add_executable(myapp ${SRC_LIST} ${RESOURCES)
to
find_package(Qt5QuickCompiler) qtquick_compiler_add_resources(RESOURCES example.qrc) add_executable(myapp ${SRC_LIST} ${RESOURCES)
So I changed my CMakeLists.txt to
find_package(Qt5QuickCompiler) qtquick_compiler_add_resources("QML_RESOURCE" "qml.qrc") qt5_add_binary_resources("res" ${QML_RESOURCE} DESTINATION "qml.rcc")
But now I get
FAILED: qml.rcc cmd.exe /C "cd /D "D:\buildPath" && C:\Qt\5.12.3\msvc2017_64\bin\rcc.exe --binary --name res --output qml.rcc "D:/buildPath/main_qml.cpp" "D:/buildPath/qmlcache_loader.cpp""
RCC Parse Error: 'D:/buildPath/main_qml.cpp' Line: 1 Column: 1 [Start tag expected.] [2/4 30.3/sec] Automatic MOC for target PROJECT_NAME ninja: build stopped: subcommand failed.
17:10:39: The process "C:\Program Files\CMake\bin\cmake.exe" exited with code 1. Error while building/deploying project PROJECT_NAME (kit: Desktop Qt 5.12.3 MSVC2017 64bit) When executing step "Build with CMake"
There isn't much information about Qt and CMake, so I'm not sure if there is something wrong in my script/Setup or if it's something else. I hope someone can give me some advice.
ps: I'm using QtCreator 4.9.1, Windows 10 and Qt 5.12.3