CMake: Limit warnings_are_errors flags to C++ and Objective-C++
Otherwise when applied to bundled 3rd party library C files, the MinGW build fails when compiling src/3rdparty/md4c/md4c.c. Change-Id: Ia522b10aa69aa15f239d20c65e31c84edbccee6d Reviewed-by: Simon Hausmann <hausmann@gmail.com>
This commit is contained in:
parent
c85b393023
commit
27aeb30b5d
@ -58,8 +58,15 @@ function(qt_internal_set_warnings_are_errors_flags target)
|
||||
list(APPEND flags /WX)
|
||||
endif()
|
||||
endif()
|
||||
set(add_flags "$<NOT:$<BOOL:$<TARGET_PROPERTY:QT_SKIP_WARNINGS_ARE_ERRORS>>>")
|
||||
set(flags_generator_expression "$<${add_flags}:${flags}>")
|
||||
set(warnings_are_errors_enabled_genex
|
||||
"$<NOT:$<BOOL:$<TARGET_PROPERTY:QT_SKIP_WARNINGS_ARE_ERRORS>>>")
|
||||
|
||||
# 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 "$<OR:$<COMPILE_LANGUAGE:CXX>,$<COMPILE_LANGUAGE:OBJCXX>>")
|
||||
set(final_condition_genex "$<AND:${warnings_are_errors_enabled_genex},${cxx_only_genex}>")
|
||||
set(flags_generator_expression "$<${final_condition_genex}:${flags}>")
|
||||
target_compile_options("${target}" INTERFACE "${flags_generator_expression}")
|
||||
endfunction()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user