Header only library & clangd
Hi there!
In developing a C++ library that is mostly header based, I'm having the most frustrating experience with getting clangd to work properly in VSCode.
Apparently you don't provide a set of include folders (which I'd be happy to), instead you're supposed to rely on clangd's ability to "infer" the build context from cmake's compilecommands.json.
Except clangd invariably gets that part wrong, mixes all up with external dependencies and other branches of my source tree..
What I attempted is to use cmake to generate a cpp file which includes each header in the branch and create an ad'hoc target where I set the correct include paths. The dummy TU, does appear in the compilecommands file, along with the proper include paths, but it looks like that isn't enough.
Had anyone managed to get this right ? I'd be glad to hear about...
Thx.
Edit To clarify : actual compilation is working perfectly fine (according to proper include folders set in the targets), it's just clangd making my life miserable rn by littering my code with a staggering amount of squiggles 😬
https://redd.it/1o6f4ab
@r_cpp
Post #24059
20