neovim/neovim — pull request #1403 by fwalch (2014-11-05 19:58:20+00:00)
Title: [RFC] version: Add compilation info.

Sample output of `nvim --version`:

>NVIM 0.0.0-alpha+201411051757 (compiled Nov 5 2014 20:51:32)
Commit: ebc703f79070a31aaf8b88268e00f7ccb7ae255e
Build type: RelWithDebInfo
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -DINCLUDE_GENERATED_DECLARATIONS -DHAVE_CONFIG_H -I/home/florian/Projects/neovim/build/config -I/home/florian/Projects/neovim/src -I/home/florian/Projects/neovim/.deps/usr/include -I/home/florian/Projects/neovim/.deps/usr/include -I/home/florian/Projects/neovim/.deps/usr/include/luajit-2.0 -I/home/florian/Projects/neovim/build/src/nvim/auto -I/home/florian/Projects/neovim/build/include

Note that includes are not fully correct (always `-I`, but some should be `-isystem`), but otherwise it looks pretty good when comparing it with `build/compile_commands.json`. If someone has an idea, please come forward :-)

This uses the "semi-deprecated" `DEFINITIONS` property (CMake doesn't emit a warning, but the [docs](http://www.cmake.org/cmake/help/v3.0/prop_dir/DEFINITIONS.html) mention that `COMPILE_DEFINITIONS` should be used instead), but I didn't find another way to get the `-Wall`/.. flags set with `add_definition()`; `COMPILE_DEFINITIONS` only gives the `-D...` flags.´

Thanks to @zaufi for the idea and the link in http://stackoverflow.com/questions/26699190/get-full-compilation-command-in-cmake/26707132#26707132.