diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake index 2208c28f34..b3c1f00345 100644 --- a/cmake/QtInternalTargets.cmake +++ b/cmake/QtInternalTargets.cmake @@ -217,6 +217,21 @@ elseif(UIKIT) target_compile_definitions(PlatformCommonInternal INTERFACE GLES_SILENCE_DEPRECATION) endif() +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" + AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "14.0.0" +) + # Xcode 14's Clang will emit objc_msgSend stubs by default, which ld + # from earlier Xcode versions will fail to understand when linking + # against static libraries with these stubs. Disable the stubs explicitly, + # for as long as we do support Xcode < 14. + set(is_static_lib "$,STATIC_LIBRARY>") + set(is_objc "$") + set(is_static_and_objc "$") + target_compile_options(PlatformCommonInternal INTERFACE + "$<${is_static_and_objc}:-fno-objc-msgsend-selector-stubs>" + ) +endif() + if(MSVC) target_compile_definitions(PlatformCommonInternal INTERFACE "_CRT_SECURE_NO_WARNINGS"