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.

Pick-to: 6.7
Change-Id: I241a950a3d2e70652a3a6386e5dd86c681d1c13f
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Orkun Tokdemir <orkun.tokdemir@qt.io>
bb10
Tor Arne Vestbø 2024-04-03 11:04:16 +02:00
parent 58ff4e22f7
commit 2e97906593
1 changed files with 9 additions and 9 deletions

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)