Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.15.0
-
-
dd9e41d1a5138fd58759c847525de7453efd2f00 (qt/qtdeclarative/5.15) 749ca5d0272eec49c2986eecebe897d311cbf372 (qt/qtdeclarative/5.15)
Description
For such simplified cmake file (created by qt creator and stripped from android support):
cmake_minimum_required(VERSION 3.5) project(cmake_compile_qml LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt5 COMPONENTS Core Quick QuickCompiler REQUIRED) qtquick_compiler_add_resources(gui_RCC_SRCS qml.qrc) #qt_add_resources(gui_RCC_SRCS qml.qrc) add_executable(cmake_compile_qml main.cpp ${gui_RCC_SRCS} ) target_compile_definitions(cmake_compile_qml PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) target_link_libraries(cmake_compile_qml PRIVATE Qt5::Core Qt5::Quick)
and qml.qrc:
<RCC>
<qresource prefix="/">
<file>main.qml</file>
</qresource>
</RCC>
all works fine at least for Linux/ninja/make and macOS/iOS/xcode.
But if add new qml file (Hello.qml):
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>Hello.qml</file>
</qresource>
</RCC>
build failed with such error:
/usr/bin/ld: CMakeFiles/cmake_compile_qml.dir/qmlcache_loader.cpp.o:(.data.rel.ro+0x20): undefined reference to `QmlCacheGeneratedCode::_0x5f__Hello_qml::qmlData' collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/cmake_compile_qml.dir/build.make:169: cmake_compile_qml] Error 1 make[1]: *** [CMakeFiles/Makefile2:96: CMakeFiles/cmake_compile_qml.dir/all] Error 2 make: *** [Makefile:104: all] Error 2
I have to rerun cmake and only then I can compile project successfully.
By the way the same problem if I build cmake project in Qt Creator.
All works fine if I comment qtquick_compiler_add_resources and uncomment qt_add_resources, I can add new files without problem.
Attachments
For Gerrit Dashboard: QTBUG-85190 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
306774,3 | QtQuickCompiler: list rcc file as dependency of generated files | 5.15 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
306776,5 | Prepare Qt5QuickCompiler.cmake.in for Qt6 | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
306793,4 | Add cmake directory dependency for .rcc files process by qmlcachegen | 5.15 | qt/qtdeclarative | Status: MERGED | +2 | 0 |