Xcode: Use ad-hoc signing during compiler id on macOS

Xcode 14 no longer accepts an empty signing identity for macOS.
However, Xcode in general does not accept an ad-hoc signing
identity for iOS.  Switch based on the target platform.

Fixes: #23609
This commit is contained in:
Brad King 2022-06-10 12:29:28 -04:00
parent b243367b36
commit 89e1113e0c
2 changed files with 3 additions and 1 deletions

View File

@ -594,6 +594,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
endif() endif()
endif() endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_OSX_SYSROOT MATCHES "^$|[Mm][Aa][Cc][Oo][Ss]") if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_OSX_SYSROOT MATCHES "^$|[Mm][Aa][Cc][Oo][Ss]")
set(id_code_sign_identity "-")
# When targeting macOS, use only the host architecture. # When targeting macOS, use only the host architecture.
if (_CMAKE_APPLE_ARCHS_DEFAULT) if (_CMAKE_APPLE_ARCHS_DEFAULT)
set(id_archs "ARCHS = \"${_CMAKE_APPLE_ARCHS_DEFAULT}\";") set(id_archs "ARCHS = \"${_CMAKE_APPLE_ARCHS_DEFAULT}\";")
@ -603,6 +604,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
set(id_arch_active "ONLY_ACTIVE_ARCH = YES;") set(id_arch_active "ONLY_ACTIVE_ARCH = YES;")
endif() endif()
else() else()
set(id_code_sign_identity "")
set(id_archs "") set(id_archs "")
set(id_arch_active "ONLY_ACTIVE_ARCH = YES;") set(id_arch_active "ONLY_ACTIVE_ARCH = YES;")
endif() endif()

View File

@ -72,7 +72,7 @@
1DEB928608733DD80010E9CD = { 1DEB928608733DD80010E9CD = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CODE_SIGN_IDENTITY = ""; CODE_SIGN_IDENTITY = "@id_code_sign_identity@";
PRODUCT_NAME = CompilerId@id_lang@; PRODUCT_NAME = CompilerId@id_lang@;
}; };
name = Debug; name = Debug;