0

According to docs, I have following cmake project

cmake_minimum_required(VERSION 3.5)

project(teeest LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(LLVM REQUIRED)
find_package(Clang REQUIRED)


add_executable(teeest main.cpp)
target_link_libraries(teeest
    PRIVATE
    clangAST
    clangFrontend
    clangTooling
)

but when I try to build the project, I get follwing error

/usr/bin/ld: cannot find -lclangAST
/usr/bin/ld: cannot find -lclangFrontend
/usr/bin/ld: cannot find -lclangTooling

I have install llvm package from archlinux's repository

너를 속였다
  • 899
  • 11
  • 26
  • The usage of `find_package` described here is a bit different to yours: https://llvm.org/docs/CMake.html#embedding-llvm-in-your-project does the linked approach work for you? – fabian Jan 05 '22 at 18:01
  • @fabian, I tried putting different text versions of `libtooling` in `llvm_map_components_to_libnames` but its not working – 너를 속였다 Jan 05 '22 at 18:26
  • Might be a duplicate or at least helpful: https://stackoverflow.com/q/8774593/2799037 – usr1234567 Jan 05 '22 at 18:52

1 Answers1

0

Following helped me resolve the error:

find_package( LLVM  REQUIRED CONFIG )
find_package( Clang REQUIRED CONFIG )
NutCracker
  • 11,485
  • 4
  • 44
  • 68