I am trying to use libclang for some source parsing on linux. I have libclang-dev installed and it appears under the list of packages for apt on my system.
However when i try to add it as a dependency through any of:
dependency('clang')
dependency('libclang')
dependency('libclang-dev')
dependency('libclang-cpp-dev')
In all cases I get
Run-time dependency clang found: NO (tried pkgconfig and cmake)
Despite it no being able to find it in my system I thought I could just compile it from source. To that effect I tried this:
opt_var = cmake.subproject_options()
opt_var.append_link_args('-fPIC')
sub_proj = cmake.subproject('clang', options : opt_var)
clang = sub_proj.dependency('clang')
Which gives :
../subprojects/clang/meson.build:0:0: ERROR: Can't link non-PIC static library 'clangBasic' into shared library 'clang_cpp'. Use the 'pic' option to static_library to build with PIC.
I tested compilation of clang outside of meson (i.e. i made a build directory and did cmake .. && make) and it works so this is a problem with how meson is calling cmake, not with the library.
Any ideas?