Search code examples
xcodecmakexcode14

Xcode 14 beta: CMake not able to resolve CMAKE_C_COMPILER and CMAKE_CXX_COMPILER


Trying to run cmake to create an Xcode project using:

cmake -G Xcode ..

This has been running perfectly under Xcode 13 and below. But under Xcode 14 beta, suddenly if fails, and I get the following output:

-- Found Git: /usr/bin/git (found version "2.32.1 (Apple Git-133)")
-- Found PythonInterp: /usr/local/bin/python3 (found suitable version "3.9", minimum required is "3")
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:17 (project):
  No CMAKE_C_COMPILER could be found.

CMake Error at CMakeLists.txt:17 (project):
  No CMAKE_CXX_COMPILER could be found.

More detail from CMakeFiles/CMakeError.log includes:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.

error: An empty identity is not valid when signing a binary for the product type 'Command-line Tool'. (in target 'CompilerIdC' from project 'CompilerIdC')

What's going on here, and how can I fix it?


Solution

  • Update to at least cmake v3.23.3; cmake will internally set CODE_SIGN_IDENTITY to "-". Prior to v3.23.3, attempting to set CODE_SIGN_IDENTITY="-" still produced the empty identity error.