cmake: Skip warnings-are-errors when using Xcode generator

Xcode enables additional warnings that we are not warning-clean from.

It also sets C++ hardening explicitly, which clashes with our own
hardening define, causing a warning. Attempts at solving this via
generator-specific genex or propagating interface properties on
PlatformCommonInternal did not succeed.

https://gitlab.kitware.com/cmake/cmake/-/issues/26321

Pick-to: 6.8
Change-Id: I5ae4eb3006fcd8152441b6470879123076de8e58
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Tor Arne Vestbø 2024-09-24 13:10:43 +02:00
parent fd00d5569e
commit 0423908e05

View File

@ -318,7 +318,10 @@ endfunction()
# Sets the default warnings behavior according to the WARNINGS_ARE_ERRORS and
# QT_REPO_NOT_WARNINGS_CLEAN flags.
function(qt_internal_default_warnings_are_errors target)
if(WARNINGS_ARE_ERRORS AND NOT QT_REPO_NOT_WARNINGS_CLEAN)
if(WARNINGS_ARE_ERRORS AND NOT QT_REPO_NOT_WARNINGS_CLEAN
# Xcode enables additional warnings on top of the ones we
# enable, and we are not warning clean in that context.
AND NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode")
qt_internal_set_skip_warnings_are_errors("${target}" FALSE)
else()
qt_internal_set_skip_warnings_are_errors("${target}" TRUE)