From 2e97906593bca028e5a173264c05edb18427381f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 3 Apr 2024 11:04:16 +0200 Subject: [PATCH] cmake: Selectively enable -no_warn_duplicate_libraries for Xcode 15+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Orkun Tokdemir --- cmake/QtInternalTargets.cmake | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake index 0bc194d041d..b26ec63ccd4 100644 --- a/cmake/QtInternalTargets.cmake +++ b/cmake/QtInternalTargets.cmake @@ -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 "$,15>") + target_link_options(PlatformCommonInternal INTERFACE + "$<${is_xcode15}:LINKER:-no_warn_duplicate_libraries>") endif() if(MSVC)