Skip to content

Commit

Permalink
Fix qt6_add_big_resources
Browse files Browse the repository at this point in the history
The qt6_add_big_resources command was dysfunctional whenever AUTOMOC was
enabled for a target.

We passed multiple object files with the --temp argument of the second
pass of rcc. We must pass exactly one. The spurious object file was the
one that's created by AUTOMOC. Turn off all of AUTOGEN for the C++
source file that's generated in the first pass of rcc.

Enable AUTOMOC for tests/auto/cmake/test_add_big_resource to cover this
situation.

Pick-to: 6.1
Fixes: QTBUG-85051
Change-Id: I6d2ce4953297db0751913456db0a4a126fe33f14
Reviewed-by: Alexandru Croitor <[email protected]>
  • Loading branch information
jobor committed May 20, 2021
1 parent c4df673 commit 9e8f43e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/corelib/Qt6CoreMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ function(qt6_add_big_resources outfiles )
set(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.o)

_qt6_parse_qrc_file(${infile} _out_depends _rc_depends)
set_source_files_properties(${infile} PROPERTIES SKIP_AUTORCC ON)
set_source_files_properties(${infile} PROPERTIES SKIP_AUTOGEN ON)
add_custom_command(OUTPUT ${tmpoutfile}
COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::rcc ${rcc_options} --name ${outfilename} --pass 1 --output ${tmpoutfile} ${infile}
DEPENDS ${infile} ${_rc_depends} "${out_depends}" ${QT_CMAKE_EXPORT_NAMESPACE}::rcc
Expand Down
4 changes: 3 additions & 1 deletion tests/auto/cmake/test_add_big_resource/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@

cmake_minimum_required(VERSION 3.14)

project(test_add_big_resource)

# Make sure that AUTOMOC does not interfere with qt_add_big_resources
set(CMAKE_AUTOMOC ON)

find_package(Qt6Core REQUIRED)

qt_wrap_cpp(moc_files myobject.h)
Expand Down

0 comments on commit 9e8f43e

Please sign in to comment.