Export compile_commands.json in standalone builds (by default) #314
Open
Sjors wants to merge 2 commits into
Open
Export compile_commands.json in standalone builds (by default) #314Sjors wants to merge 2 commits into
Sjors wants to merge 2 commits into
Conversation
Makes clangd and other tooling work out of the box after configuring. Only applied when libmultiprocess is the top-level project, so it does not opt targets into a parent project's compile database when built as a subtree. An explicit -DCMAKE_EXPORT_COMPILE_COMMANDS=OFF or environment variable setting still takes precedence: project() copies the environment value into the cache, leaving the cache entry empty when neither is set, so the default only applies to an empty value. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
clangd only searches ancestor directories of a source file for compile_commands.json, so even with CMAKE_EXPORT_COMPILE_COMMANDS enabled it would not find the database in the build directory without a symlink in the source directory. Point it at the build/ directory suggested by doc/install.md and doc/usage.md. Developers using a differently named build directory can override this with clangd's --compile-commands-dir flag or a personal clangd user config, which takes precedence over this file. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline and AI policy for information on the review process. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This makes the default build configuration play nicely with code editors. E.g. with Zed, looking at
spawn_argvin #231:Before:

After:

One downside of this approach is that it only just works(tm) on the
builddirectory.There are several alternative approaches: