MacOS 10.13.3 的 CMake 编译器标识未知

Cha*_*avy 4 macos compiler-errors cmake

我想通过 cmake 构建 llvm,

我使用cmake -G Xcode ../llvm -DCMAKE_BUILD_TYPE:STRING=MinSizeRel.

但我有麻烦了。

错误日志是:

CMake Deprecation Warning at CMakeLists.txt:14 (cmake_policy):
  The OLD behavior for policy CMP0051 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- The ASM compiler identification is unknown
-- Found assembler: /Library/Developer/CommandLineTools/usr/bin/cc
CMake Error at CMakeLists.txt:45 (project):
  No CMAKE_C_COMPILER could be found.

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

-- Warning: Did not find file Compiler/-ASM
-- Configuring incomplete, errors occurred!
Run Code Online (Sandbox Code Playgroud)

此外,我也使用xcrun -find cc,结果是/Library/Developer/CommandLineTools/usr/bin/cc

我能做什么?请帮忙

Cha*_*avy 6

如果您已安装 Xcode,请尝试以下操作:

sudo xcode-select --reset