3

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?

Bill Hollings
  • 2,344
  • 17
  • 25

2 Answers2

6

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.

Paul Kippes
  • 96
  • 1
  • 6
  • Thanks for posting this answer, and for pointing out this is fixed deliberately and by default in recent cmake versions. I had unknowingly encountered the fix by blindly updating cmake to latest (3.24.2) from homebrew, without understanding why that had fixed it. – Bill Hollings Nov 12 '22 at 20:15
2

I had run in to similar issue before and I don't remember exactly which one of these helped but hopefully one of these can help you:

  1. CODE_SIGN_IDENTITY issue in CMake - https://gitlab.kitware.com/cmake/cmake/-/issues/23609
  2. Download the xcode 14 beta command line tools from apple
  3. run sudo xcodebuild -license (https://stackoverflow.com/a/59556807)
  4. try setting it in your scripts: -DCMAKE_C_COMPILER="$(xcrun -find cc)" and -DCMAKE_CXX_COMPILER="$(xcrun -find c++)" (CMake error no CMAKE_C_COMPILER could be found using Xcode and GLFW)
user1751536
  • 39
  • 1
  • 3