cmake: Selectively enable -no_warn_duplicate_libraries for Xcode 15+

We can't make the choice of whether to enable no_warn_duplicate_libraries
or not based on the Xcode version Qt was built with, as the target flags
will propagate to our cmake integration tests, which we run on platforms
where we don't have Xcode 15.

Change-Id: I241a950a3d2e70652a3a6386e5dd86c681d1c13f
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Orkun Tokdemir <orkun.tokdemir@qt.io>
(cherry picked from commit 2e97906593bca028e5a173264c05edb18427381f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tor Arne Vestbø 2024-04-03 11:04:16 +02:00 committed by Qt Cherry-pick Bot
parent 410b57f9a6
commit 007507b576

View File

@ -242,15 +242,15 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
"$<${is_static_and_objc}:-fno-objc-msgsend-selector-stubs>"
)
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0.0")
# A bug in Xcode 15 adds duplicate flags to the linker. In addition, the
# `-warn_duplicate_libraries` is now enabled by default which may result
# in several 'duplicate libraries warning'.
# - https://gitlab.kitware.com/cmake/cmake/-/issues/25297 and
# - https://indiestack.com/2023/10/xcode-15-duplicate-library-linker-warnings/
target_link_options(PlatformCommonInternal INTERFACE
"LINKER:-no_warn_duplicate_libraries")
endif()
# A bug in Xcode 15 adds duplicate flags to the linker. In addition, the
# `-warn_duplicate_libraries` is now enabled by default which may result
# in several 'duplicate libraries warning'.
# - https://gitlab.kitware.com/cmake/cmake/-/issues/25297 and
# - https://indiestack.com/2023/10/xcode-15-duplicate-library-linker-warnings/
set(is_xcode15 "$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,15>")
target_link_options(PlatformCommonInternal INTERFACE
"$<${is_xcode15}:LINKER:-no_warn_duplicate_libraries>")
endif()
if(MSVC)