-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Support multiple compile commands files per project #7029
Comments
Hi @stertingen . Thanks for taking the time to suggest this. Since the project is using CMake, have you considered using the CMake Tools extension? CMake Tools provides configurations to the C/C++ Extension, and should properly handle the full hierarchy of projects from a single top-level |
There exists a single top-level |
@stertingen With CMake Tools, it's possible to specify an arbitrary CMakeLists.txt location, using |
You mean, using |
@Colengms I don't think that would work for ROS since the top-level CMakeLists.txt is autogenerated. What I really want is glob support: "compileCommands": "${workspaceFolder}/build/**/compile_commands.json" |
This feature request is being closed due to insufficient upvotes. When enough upvotes are received, this issue will be eligible for our backlog. |
This feature request has received enough votes to be added to our backlog. |
For those of you needing this feature now, an easy hack is to merge all the compile_commands.json into one file. This command worked for me on a ROS project. cat build/**/compile_commands.json | jq -s 'add' > build/compile_commands.json After that, set compileCommands to "${workspaceFolder}/build/compile_commands.json" and your multi-cmake project should work |
As an alternative, there is also clangd plugin which supports multiple configs files per directory, but also regex on paths. Example
|
I would also love this feature. Well, actually I have a multiple-project-workspace and would like to have one per project. Each project generates its own compile_commands.json (naturally), so each should optimally have its own file. But I would also be fine to just have one for all. |
This may also needs adaption of The workaround of @visstro currently works! Thanks. |
Type: LanguageService
This is a feature request.
Describe the bug
Some ROS build systems (catkin_tools, catkin_make_isolated) run CMake separately in different repositories. Thus, passing
CMAKE_EXPORT_COMPILE_COMMANDS=ON
generates n files for n projects. Merging the files manually is cumbersome, so the ideal solution would be the possibility to specify multiple compile commands files and/or support wildcards in the config.Expected behavior
This configuration to be valid and all compilation databases merged:
The text was updated successfully, but these errors were encountered: