Skip to content

Export compile_commands.json in build/ so it's easy to work with several vim plugins.#52

Open
byzhang wants to merge 1 commit intopercona:masterfrom
byzhang:master
Open

Export compile_commands.json in build/ so it's easy to work with several vim plugins.#52
byzhang wants to merge 1 commit intopercona:masterfrom
byzhang:master

Conversation

@byzhang
Copy link
Copy Markdown

@byzhang byzhang commented Aug 19, 2013

No description provided.

@byzhang
Copy link
Copy Markdown
Author

byzhang commented Aug 19, 2013

@leifwalsh, it's a simple pull request.

@leifwalsh
Copy link
Copy Markdown
Contributor

Never seen this before. What does it do?

-- 

Cheers,
Leif

On Mon, Aug 19, 2013 at 1:17 PM, byzhang notifications@github.com wrote:

You can merge this Pull Request by running:
git pull https://github.com/byzhang/ft-index master
Or you can view, comment on it, or merge it online at:
https://github.com/Tokutek/ft-index/pull/52
-- Commit Summary --

@byzhang
Copy link
Copy Markdown
Author

byzhang commented Aug 19, 2013

When you run cmake .., cmake will generate compile_commands.json which basically lists per-file compiling flags, e.g.

{
"directory": "/home/byzhang/src/ft-index/build/util",
"command": "/usr/bin/c++ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_SVID_SOURCE -D_XOPEN_SOURCE=600 -D__LONG_LONG_SUPPORTED -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=c++11 -Wall -Werror -Wcast-align -Wshadow -Wmissing-format-attribute -Wpointer-arith -Wmissing-declarations -Wno-missing-noreturn -Wextra -Wno-error=strict-overflow -Wpacked -fno-exceptions -fno-rtti -Wno-error=missing-format-attribute -Wmissing-format-attribute -Wlogical-op -Wtrampolines -Wswitch -Winit-self -Wstrict-null-sentinel -Wno-missing-field-initializers -g -O3 -flto -fuse-linker-plugin -O3 -DNDEBUG -UNDEBUG -fPIC -I/home/byzhang/src/ft-index/build/buildheader -I/home/byzhang/src/ft-index/build/./xz/include -I/home/byzhang/src/ft-index/include -I/home/byzhang/src/ft-index/toku_include -I/home/byzhang/src/ft-index/portability -I/home/byzhang/src/ft-index -I/home/byzhang/src/ft-index/build -I/home/byzhang/src/ft-index/build/toku_include -isystem /usr/local/include -o CMakeFiles/util_static.dir/partitioned_counter.cc.o -c /home/byzhang/src/ft-index/util/partitioned_counter.cc",
"file": "/home/byzhang/src/ft-index/util/partitioned_counter.cc"
},

There are several vim plugins can leverage this file for autocompletion or code navigation in C++ (e.g. https://github.com/Valloric/YouCompleteMe)

@byzhang
Copy link
Copy Markdown
Author

byzhang commented Aug 19, 2013

And it's also an easy way to know what exactly the compiling flags are used.

@denji
Copy link
Copy Markdown

denji commented Jan 29, 2015

@byzhang cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants