Document that Q_INIT_RESOURCE is not necessary for CMake-based projects

Since commit e343affd634 we're creating object libraries for Qt
resources in static libraries when building Qt or a Qt-based project
with CMake. The purpose of this is to remove the need for calling
Q_INIT_RESOURCE in static libraries.

Add a note to the documentation and a changelog entry.

[ChangeLog][CMake] Calling Q_INIT_RESOURCE in static libraries is not
strictly necessary anymore for CMake-based projects. There, for each
resource, an object library is created which is linked into consuming
projects. This ensures that the linker does not discard the resource's
object file, and its initializer is called automatically.

Change-Id: I70de439f964dc7257a2255683eda4d434fa451d0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2020-06-16 11:54:14 +02:00
parent 3110cbad6f
commit e817ac3d68

View File

@ -293,6 +293,10 @@
any longer), you can force removal of your resources by calling
\l Q_CLEANUP_RESOURCE() with the same base name as above.
Note: The use of \l Q_INIT_RESOURCE() and \l Q_CLEANUP_RESOURCE() is
not necessary when the resource is built as part of the application.
\note The use of \l Q_INIT_RESOURCE() and \l Q_CLEANUP_RESOURCE() is
not necessary in the following cases:
\list
\li When the resource is built as part of the application.
\li When the resource is built with CMake as part of a static library.
\endlist
*/