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
)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With