I am using YCM to work on a pretty large C project. I generate multiple executables/static libraries hence have multiple makefiles and so multiple compilation databases (generated using BEAR) for different parts of my project (Structure of the project in the image). My problem is that YCM seems to pick a single compilation database for all the files in my vim session based on the directory where I open vim. So for example if I were to edit my server.c
and util.c
from mainserver/MainServer
AND open vim in the same directory, YCM would load their corresponding compilation database and everything works great... BUT if I were to start editing my arrayList.c
from misc/ArrayList
in the same vim session then it would still use the compilation database from mainserver/MainServer
instead of from misc/ArrayList
.
My question is how do I get YCM to load a separate compilation database for every file based on its location instead of having YCM load a compilation database depending on where I initially opened vim.
My not very practical solution was to have a single compilation database in the root of my project and generate it by having a shell script find every makefile in my project and then have BEAR generate the compilation databases and append them all at the root of my project...I am hoping there is a better option than that....
Thanks a lot for any help
make
invocation), so that you can properly handle dependencies (touching ArrayList header file to change signature of a method or class means MainServer may need to be rebuilt, or touching ArrayList implementation means you'll need to relink.) You can keep per-directory files that you include, but have a main file at the top that defines how everything is built. That way you also only use BEAR once, from the top level, and that includes everything.