From 393eb4fa97daeb417d159254a53cd926aab77415 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Wed, 15 Jun 2022 13:09:14 +0200 Subject: [PATCH] Doc: Document how to treat qt_add_big_resources args as source files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The arguments to qt_add_big_resources are not known to CMake as source files. They need to be added explicitly to a CMake target in order for Qt Creator to treat them as source files and in the case of a qrc file to expand the contents in the project view. Fixes: QTBUG-104320 Change-Id: Iea755d998e8f9814a82983272731b0c654f80644 Reviewed-by: Jörg Bornemann (cherry picked from commit 7037f4620fb59b669d32fbce0ef79aabe38a716a) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/doc/snippets/cmake-macros/examples.cmake | 5 +++++ src/corelib/doc/src/cmake/qt_add_big_resources.qdoc | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/corelib/doc/snippets/cmake-macros/examples.cmake b/src/corelib/doc/snippets/cmake-macros/examples.cmake index 31cf4811e0d..62d6324bc9b 100644 --- a/src/corelib/doc/snippets/cmake-macros/examples.cmake +++ b/src/corelib/doc/snippets/cmake-macros/examples.cmake @@ -20,6 +20,11 @@ qt_add_resources(myapp "images" #! [qt_add_big_resources] set(SOURCES main.cpp) qt_add_big_resources(SOURCES big_resource.qrc) + +# Have big_resource.qrc treated as a source file by Qt Creator +list(APPEND SOURCES big_resource.qrc) +set_property(SOURCE big_resource.qrc PROPERTY SKIP_AUTORCC ON) + add_executable(myapp ${SOURCES}) #! [qt_add_big_resources] diff --git a/src/corelib/doc/src/cmake/qt_add_big_resources.qdoc b/src/corelib/doc/src/cmake/qt_add_big_resources.qdoc index 07e75f6fc52..8cb78cf9c15 100644 --- a/src/corelib/doc/src/cmake/qt_add_big_resources.qdoc +++ b/src/corelib/doc/src/cmake/qt_add_big_resources.qdoc @@ -34,6 +34,10 @@ generates object files (\c .o, \c .obj) files instead of C++ source code. This allows to embed bigger resources, where compiling to C++ sources and then to binaries would be too time consuming or memory intensive. +\note The \c{file1.qrc} will not be treated as a source file by Qt Creator. It +needs to be added as a source file to a CMake target and have the property +\c{SKIP_AUTORCC} set to \c{ON}. + \section1 Arguments You can set additional \c{OPTIONS} that should be added to the \c{rcc} calls.