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?
2
Answers
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:
CODE_SIGN_IDENTITY
issue in CMake – https://gitlab.kitware.com/cmake/cmake/-/issues/23609sudo xcodebuild -license
(https://stackoverflow.com/a/59556807)-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)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.