Recommended Emacs package: cmake-ide

Using emacs with flycheck and company is great experience, but what bothers me is that I need to carefully set many variables so that configuration used by these helper tools matches my actual build configuration – e.g. include directories, extra compiler and linker flags etc. I need to apply these settings per-project, and keep updating them whenever I change my build config in any way. This is particularly inconvenient for projects that feature configurable build process.

I use CMake for most of my projects, and I’ve recently found a package that can utilize it to automatically configure many other Emacs packages. The package is called cmake-ide, and it is available on MELPA.

There is literally zero configuration required. It automatically discovers whether a file you are editing belongs to a CMake project, runs CMake to prepare an out-of-tree build, and investigates compile_commands.json generated by CMake to figure out the precise build config for each file. It then uses this information to set up irony, flycheck, rtags, company-clang, and probably some other packages too. Whenever build config might change, cmake-ide will automatically update everything.

Super convenient.

Advertisements