From 1152f57c1573ca4fcb10e6455874ae0a94758a05 Mon Sep 17 00:00:00 2001 From: Dmitry Vedenko Date: Tue, 23 Apr 2024 12:35:02 +0300 Subject: [PATCH] Use ld_classic when building with XCode 15 XCode 15 toolchain breaks the compatibility for macOS version older than 12 --- CMakeLists.txt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ba329940797..384567856c71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,18 +154,25 @@ set( _OPT "audacity_" ) # Our very own project project( Audacity ) -# XCode 14 no longer allows building unsigned binaries. -# So for the XCode 14 `-` is passed as the code sign identity, which stands for -# local signing. `--deep` is passed, because 3d party libraries are copied unsigned. -# XCODE_VERSION is defined only after the project() command - if( APPLE ) + # XCode 14 no longer allows building unsigned binaries. + # So for the XCode 14 `-` is passed as the code sign identity, which stands for + # local signing. `--deep` is passed, because 3d party libraries are copied unsigned. + # XCODE_VERSION is defined only after the project() command if (XCODE_VERSION VERSION_LESS 14) set( CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" CACHE INTERNAL "" ) else() set( CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "-" CACHE INTERNAL "" ) set( CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "--deep -o linker-signed --timestamp" CACHE INTERNAL "") endif() + + # Xcode 15 breaks compatibility with macOS vesions older than 12 + # https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking + if (XCODE_VERSION VERSION_GREATER_EQUAL 15) + # link_libraries is guaranteed to set the flag for all + # linker invocations + link_libraries("-Wl,-ld_classic") + endif() endif() # Load our functions/macros