diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2024-04-03 11:04:16 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2024-04-04 01:26:56 +0200 |
commit | 2e97906593bca028e5a173264c05edb18427381f (patch) | |
tree | 465e3bc5f0c683a8a2ab42dd1937febe714a62a1 /cmake/QtInternalTargets.cmake | |
parent | 58ff4e22f742d3b2331b44b1a0e5a14589cfe2cc (diff) |
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>
Diffstat (limited to 'cmake/QtInternalTargets.cmake')
-rw-r--r-- | cmake/QtInternalTargets.cmake | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake index 0bc194d041..b26ec63ccd 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 "$<VERSION_GREATER_EQUAL:$<CXX_COMPILER_VERSION>,15>") + target_link_options(PlatformCommonInternal INTERFACE + "$<${is_xcode15}:LINKER:-no_warn_duplicate_libraries>") endif() if(MSVC) |