emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Project out of sources compilation


From: Ergus
Subject: Re: Project out of sources compilation
Date: Sat, 16 Mar 2024 20:00:10 +0100

Hi:

On Sat, Mar 16, 2024 at 07:50:49PM +0300, Konstantin Kharlamov wrote:
On Sat, 2024-03-16 at 14:12 +0100, Ergus wrote:
2. Eglot compilations database place.

When compilation is out of sources the cmake generated
compile_commands.json also goes in that directory by default.

This issue can be managed with a line in dir-locals, or just manually
coping the database.

((eglot-workspace-configuration
        � . (:clangd (:initializationOptions
(:compilationDatabasePath
        � "build")))))

Just wanted to clarify two things:

1. You can't just copy clangd database (i.e. `compile_commands.json`)
because the field "directory" has absolute path and clangd doesn't
support relative one. So you'll also have to regexp-replace the paths
after it's been copied.

Yes, I know that (now). But that is actually the most popular solution in:

https://emacs.stackexchange.com/questions/73922/how-do-you-tell-eglot-and-clangd-about-the-compilation-database-compile-command

2. If your out-of-source dir is called `build/`, then you don't need to
configure clangd to support it, because it handles that special case.

Good to know, I didn't know because I always use names like build_debug,
build_x64, build_clang and so on.

Probably some simple slight integration of Eglot with Project may
help.

�� 2.1 This mixes with the previous one because if we change the
�� compilation directory the line with initializationOptions is not
�� updated and requires manual intervention

Some generic support for pointing out the compilation dir sounds indeed
useful if it's possible.

Lets wait for Dmitry's suggestion.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]