构建 clang-query 时遇到 cmake 错误

构建 clang-query 时遇到 cmake 错误

当我尝试构建 clang-query 时遇到以下错误。

parallels@ubuntu18:~/myllvm/llvm/tools/clang/tools/extra/clang-query$ cmake .
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:6 (add_clang_library):
Unknown CMake command "add_clang_library".


CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.13)

should be added at the top of the file.  The version specified may be lower
if you wish to support older CMake versions for this project.  For more
information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!
See also "/home/parallels/myllvm/llvm/tools/clang/tools/extra/clang-query/CMakeFiles/CMakeOutput.log".

我很困惑应该在哪里运行 cmake cmd。

答案1

如果你克隆llvm 项目来自 GitHub,您可以关注LLVM 指南

git clone https://github.com/llvm/llvm-project.git
cd llvm-project
mkdir build
cd build
cmake -DLLVM_ENABLE_PROJECTS="clang-tools-extra" ../llvm

然后运行make clang-query来构建它。

相关内容