#StackBounty: #c++ #cmake #clang #llvm #clion Unknown CMake command "add_clang_executable"

Bounty: 50

I am trying to build a clang tool, and I am trying to debug it using CLion. However, I can’t get it to compile as a standalone binary. Currently I have this in my CMakeLists.txt:

add_clang_executable(clang_my_tool my_tool_util.h my_tool_util.cpp ClangMyTool.cpp)

target_link_libraries(clang_my_tool PRIVATE clangTooling)

However, it’s giving me the error message:

Unknown CMake command "add_clang_executable".

I know I need to add an directory, but I don’t know which one to add.

My llvm directory looks something like this:

llvm
|-build
  |- ...
|
|-clang
  |-tools
    |-clang_my_tool
      |-ClangMyTool.cpp
      |-my_tool_util.h
      |-my_tool_util.c
      |-CMakeLists.txt
|- ... other directories...

What do I add to my CMakeLists.txt?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.