3) By default, spacemacs configures ycmd for getting the compilation flags from either
a compile_commands.json or a .clang_complete file and get additionnal flags from a
.ycm_extra_flags file. If you do not like this behaviour, you can write your own
[[https://github.com/Valloric/YouCompleteMe/blob/master/README.md#c-family-semantic-completion][.ycm_extra_conf.py file]]. See [[#configuration][Configuration]] for more details.
Spacemacs will search for a compile_command.json or fall back to a
.clang_complete file in all parent directories of the current translation unit.
Spacemacs will try to make up for missing files in the compile_commands.json
using heuristics described in global_conf.py.
The user can provide additionnal flags by writing a .ycm_extra_flags in any
parent directory of the current translation unit. This is particularly useful
when cross-compiling.
Example .ycm_extra_flags:
#+BEGIN_SRC conf
# Additionnal flags for ycmd
--sysroot="/path/to/your/toolchain/libc" # if you are cross-compiling
#+END_SRC
If your build system doesn't handle the creation of a compile_commands.json,
you can use tools such as [[https://github.com/rizsotto/Bear][Bear]] or [[https://pypi.python.org/pypi/scan-build][scan-build]] to generate it, which both work