[cfe-dev] LibTooling CMake Error

Philip Craig philipjcraig at gmail.com
Fri Oct 19 04:12:55 PDT 2012


On Fri, Oct 19, 2012 at 8:52 PM, madil90 <madil90 at gmail.com> wrote:
> Hi,
>    I am trying to setup LibTooling for clang. I have gone through the
> procedure given at </a>
> <http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html> . I can
> succesfully run clang-check for any source file. I am now trying to compile
> the example at  </a> <http://clang.llvm.org/docs/RAVFrontendAction.html> .
> When using cmake, I get the following error:
>
> Unknown CMake command : add_clang_executable
>
>   When using cmake to build clang, I used -DEXPORT_CMAKE_COMPILE_COMMANDS=ON
> variable as suggested. Then why isn't this command working?

add_clang_executable is defined in the clang cmake files, so to use it
you need to build the example as part of clang. If you want to follow
this route, then a convenient place in the tree to put it is in the
extra tools repository. Have a look at
http://clang.llvm.org/docs/ClangTools.html

Alternatively, to build standalone, you can try copying the cmake
configuration from
https://github.com/philipc/clang-ast/blob/master/CMakeLists.standalone
and https://github.com/philipc/clang-ast/blob/master/cmake/modules/FindLibClang.cmake



More information about the cfe-dev mailing list