Compile of CMakeC{,XX}CompilerId.c fails on Xcode 14.1 "empty identity not valid"
I just updated to Xcode 14.1 and I can no longer configure my project: "No CMAKE_C_COMPILER could be found" or CMAKE_CXX_COMPILER. Here is part of the error log
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler:
Build flags:
Id flags:
The output was:
65
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
Computing target dependency graph and provisioning inputs
Create build description
Build description signature: a16ab35279f90ba6179b1249c98d244c
Build description path: /Users/mark/Projects/khronos/github/KTX-Software/build/macos/CMakeFiles/3.22.1/CompilerIdC/./XCBuildData/a16ab35279f90ba6179b1249c98d244c-desc.xcbuild
warning: Building targets in manual order is deprecated - check "Parallelize build for command-line builds" in the project editor, or set DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING in any of the targets in the current build to suppress this warning
error: An empty identity is not valid when signing a binary for the product type 'Command-line Tool'. (in target 'CompilerIdC' from project 'CompilerIdC')
warning: Traditional headermap style is no longer supported; please migrate to using separate headermaps and set 'ALWAYS_SEARCH_USER_PATHS' to NO. (in target 'CompilerIdC' from project 'CompilerIdC')
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'CompilerIdC' from project 'CompilerIdC')
** BUILD FAILED **
It shows the same for all the other attempts to compile CMakeC{,XX}CompilerId.c.
I have XCODE_CODE_SIGN_IDENTITY
set to my "Developer ID Application" signing key's identity.
I'm using cmake version 3.22.1 on macOS Monterey 12.6.1. Ventura is not available for my MBP.
I'd like to try to workaround this by manually setting CMAKE_C{,XX}_COMPILER but (a) these variables don't show up in the GUI, even with Advanced checked, and (b) I don't know what to set them to: full path to the compiler, to xcodebuild, something else.
My project is completely stuck so I will appreciate some quick help.