From 2bf49e089a7a29f49a364697f87f085243d662e5 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 9 Jun 2020 16:02:55 +0200 Subject: CMake: Fix failing 32 bit debug builds on MinGW When doing a doing a 32 debug build, and trying to compile one of the qml type registrations files, the following error can happen as.exe: quick_qmltyperegistrations.cpp.obj: too many sections (44466) Fatal error: can't close src/quick/CMakeFiles/Quick.dir/quick_qmltyperegistrations.cpp.obj: File too big The fix is to compile these specific files with the -Wa,-mbig-obj compile flag, which uses a munged COFF format that allows more than 32k sections in one file. Task-number: QTBUG-84886 Change-Id: Ic22e0ac409af6232db83c8a4856d5d260a0e20ff Reviewed-by: Cristian Adam --- src/qml/Qt6QmlMacros.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/qml/Qt6QmlMacros.cmake') diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake index 43a590d310..d04d663656 100644 --- a/src/qml/Qt6QmlMacros.cmake +++ b/src/qml/Qt6QmlMacros.cmake @@ -616,8 +616,16 @@ function(qt6_qml_type_registration target) ) target_sources(${target} PRIVATE ${type_registration_cpp_file}) + + # Circumvent "too many sections" error when doing a 32 bit debug build on Windows with + # MinGW. + set(additional_source_files_properties "") + if(MINGW) + set(additional_source_files_properties "COMPILE_OPTIONS" "-Wa,-mbig-obj") + endif() set_source_files_properties(${type_registration_cpp_file} PROPERTIES SKIP_AUTOGEN ON + ${additional_source_files_properties} ) # Usually for Qt Qml-like modules and qml plugins, the installation destination of the .qmltypes -- cgit v1.2.3