Build llvm ClangTool

本秂侑毒 提交于 2020-01-10 14:16:23

问题


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)

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
)

回答1:


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
)

This is because add_llvm_executable uses such signature and you can't mix them in CMake.



来源:https://stackoverflow.com/questions/47737558/build-llvm-clangtool

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!