diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake index 16db6e4bf0..6940a367ac 100644 --- a/cmake/QtInternalTargets.cmake +++ b/cmake/QtInternalTargets.cmake @@ -58,8 +58,15 @@ function(qt_internal_set_warnings_are_errors_flags target) list(APPEND flags /WX) endif() endif() - set(add_flags "$>>") - set(flags_generator_expression "$<${add_flags}:${flags}>") + set(warnings_are_errors_enabled_genex + "$>>") + + # Apprently qmake only adds -Werror to CXX and OBJCXX files, not C files. We have to do the + # same otherwise MinGW builds break when building 3rdparty\md4c\md4c.c (and probably on other + # platforms too). + set(cxx_only_genex "$,$>") + set(final_condition_genex "$") + set(flags_generator_expression "$<${final_condition_genex}:${flags}>") target_compile_options("${target}" INTERFACE "${flags_generator_expression}") endfunction()