Xcode 14测试版:CMake无法解析CMAKE_C_COMPILER和CMAKE_CXX_COMPILER

vmjh9lq9  于 2022-11-24  发布在  其他
关注(0)|答案(2)|浏览(293)

尝试运行cmake以使用以下内容创建Xcode项目:

cmake -G Xcode ..

在Xcode 13及更低版本下,这个程序一直运行得很好。但是在Xcode 14测试版下,如果突然失败,我会得到下面的输出:

-- 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.

CMakeFiles/CMakeError.log的更多详细信息包括:

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')

这是怎么回事,我该怎么解决?

unguejic

unguejic1#

更新至至少可执行make v3.23.3; cmake会在内部将CODE_SIGN_IDENTITY设置为“-"。在v3.23.3之前的版本中,尝试设置CODE_SIGN_IDENTITY="-”仍会产生空标识错误。

avwztpqn

avwztpqn2#

我以前遇到过类似问题,我不记得具体哪一个有帮助,但希望其中一个能帮助您:

  1. CMake中的CODE_SIGN_IDENTITY问题-https://gitlab.kitware.com/cmake/cmake/-/issues/23609
    1.从apple下载xcode 14测试版命令行工具
    1.运行sudo xcodebuild -licensehttps://stackoverflow.com/a/59556807
    1.请尝试在脚本中进行设置:-DCMAKE_C_COMPILER="$(xcrun -find cc)"-DCMAKE_CXX_COMPILER="$(xcrun -find c++)"(CMake错误,使用Xcode和GLFW无法找到CMAKE_C_COMPILER)

相关问题