编译llvm ClangTool [英] Build llvm ClangTool
本文介绍了编译llvm ClangTool的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I managed to build llvm and clang and now I am trying to create a ClangTool according to clang docs. But I am getting the following error when I am trying to build it:
CMake Error at tools/clang/tools/loop-convert/CMakeLists.txt:6 (target_link_libraries):
The keyword signature for target_link_libraries has already been used with
the target "loop-convert". All uses of target_link_libraries with a target
must be either all-keyword or all-plain.
The uses of the keyword signature are here:
* cmake/modules/LLVM-Config.cmake:105 (target_link_libraries)
* cmake/modules/AddLLVM.cmake:771 (target_link_libraries)
我当前的CMakeLists.txt是:
My current CMakeLists.txt is:
set(LLVM_LINK_COMPONENTS support)
add_clang_executable(loop-convert
LoopConvert.cpp
)
target_link_libraries(loop-convert
clangTooling
clangBasic
clangASTMatchers
)
推荐答案
您需要使用target_link_libraries
的关键字签名;有效地,您需要在CMakeLists.txt
的target_link_libraries
语句中添加PRIVATE
:
You need to use keyword signature of target_link_libraries
; effectively, you need to add PRIVATE
to the target_link_libraries
statement in your CMakeLists.txt
:
target_link_libraries(loop-convert PRIVATE
clangTooling
clangBasic
clangASTMatchers
)
这是因为add_llvm_executable
使用此类签名,并且您无法在CMake中将其混合.
This is because add_llvm_executable
uses such signature and you can't mix them in CMake.
这篇关于编译llvm ClangTool的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文