-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Producing a compile_commands.json #212
Comments
Usually I use hand written Makefiles, and the Bear tool is run like so: The -B flag forces a complete build, and the Bear program parses the output of Make to build a structured JSON file enumerating the included files for each output. |
Currently generation of the compile_commands.json file only happens when using one of the VSCode build configs (for similar reasons, so that VSCode can figure out the header search paths, defines etc..). It's possible to get the same behaviour for other build configs via custom build configs by adding a cmake definition for CMAKE_EXPORT_COMPILE_COMMANDS=ON, but I'll just go ahead to always enable this... one sec... |
...ok, compile_commands.json is now always generated when running |
...wait there's a problem, CMAKE_EXPORT_COMPILE_COMMANDS is only implemented by the ninja and make generators: https://cmake.org/cmake/help/v3.5/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html I need to add a fix back in which only sets the define when the ninja or make generator is used... |
Ok, fix is in 274d0ff |
Why was this feature removed in 9512fb6 ? |
Hmm, probably fallout from the changes to write a CMakePresets.json, but not sure if this broke compile_commands.json or I thought that compile_commands.json would no longer be needed since IDEs use the CMakePresets.json file to figure out the information that's been written to compile_commands.json previously. It may also be that having both a compile_commands.json and CMakePresets.json file confused the VSCode CMake Tools extension. What's your use case for the compile_commands.json file? |
I use It needs |
BTW, I am able to run But it would be nice if I would not have to. :-) |
FYI I reverted that change again in ae37991, so |
Works fine! Thanks. I just need to create
|
I'm wondering how I might use this system together with Bear (or producing the compile_commands.json file with CMake directly).
It's basically a file that tells where the includes for a project are so that IDEs and code editors can provide completion and other features.
The text was updated successfully, but these errors were encountered: