diff options
authorAlexandru Croitor <>2019-03-18 11:29:16 +0100
committerAlexandru Croitor <>2019-04-02 12:22:29 +0000
commite5f0fec762771733e9cbc9a29cade7533f49d802 (patch)
parent05d9195669216038569aff7cf2901bd8e7a71ceb (diff)
Fix disabling AUTOMOC and AUTOUIC for generated resource cpp files
when using qt5_add_big_resources. The previous approach of just setting SKIP_AUTOMOC and SKIP_AUTOUIC on the generated source files is not enough because if AUTOMOC is globally enabled, AUTOMOC will still run for the rcc_object_{outfilename} target, which ends up creating a mos_compilation.cpp.o file and adding it as a target object to the target. Thus later when $<TARGET_OBJECTS:rcc_object_${outfilename}> is passed to the rcc invocation, the expression evaluates to a list of two files: the rcc-related .o file and the mocs_compilation.o file. Obviously that breaks the rcc invocation. The fix is to disable AUTOMOC and AUTOUIC on the whole target, instead of just the source files. This prevents the creation of the mocs_compilation.cpp file. Fixes: QTBUG-74270 Change-Id: I51f757b110e940fe224010acb25b88c52ef612b1 Reviewed-by: Kai Koehne <>
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake
index 620795d2cf..7ae5e4fd16 100644
--- a/src/corelib/Qt5CoreMacros.cmake
+++ b/src/corelib/Qt5CoreMacros.cmake
@@ -321,10 +321,10 @@ function(QT5_ADD_BIG_RESOURCES outfiles )
add_custom_command(OUTPUT ${tmpoutfile}
COMMAND ${Qt5Core_RCC_EXECUTABLE} ${rcc_options} --name ${outfilename} --pass 1 --output ${tmpoutfile} ${infile}
DEPENDS ${infile} ${_rc_depends} "${out_depends}" VERBATIM)
- set_source_files_properties(${tmpoutfile} PROPERTIES SKIP_AUTOMOC ON)
- set_source_files_properties(${tmpoutfile} PROPERTIES SKIP_AUTOUIC ON)
add_custom_target(big_resources_${outfilename} ALL DEPENDS ${tmpoutfile})
add_library(rcc_object_${outfilename} OBJECT ${tmpoutfile})
+ set_target_properties(rcc_object_${outfilename} PROPERTIES AUTOMOC OFF)
+ set_target_properties(rcc_object_${outfilename} PROPERTIES AUTOUIC OFF)
add_dependencies(rcc_object_${outfilename} big_resources_${outfilename})
add_custom_command(OUTPUT ${outfile}