Skip to content
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

Setting project include dirs is painful #33

Open
ruffianeo opened this issue Nov 17, 2022 · 0 comments
Open

Setting project include dirs is painful #33

ruffianeo opened this issue Nov 17, 2022 · 0 comments

Comments

@ruffianeo
Copy link

ruffianeo commented Nov 17, 2022

Documentation is sparse. It implies, from what is written there, that I could do something like this:

(defun my-project-dirs (basedir)
  (mapcar #'(lambda (r) (expand-file-name (concat (expand-file-name basedir) "/" r)))
          '("." "..")))
(setq flymake-proc-get-project-include-dirs-function #'my-project-dirs)

Doing that in *scratch* buffer does not change the fact, that my

#include <args.hpp> // resides in BASEDIR/..

Is still not recognized.

Then there are the ways, not mentioned in above documentation (some project local .el file with an eval statement) and whatever else google yields on the subject.

I am aware, I could write #include "../args.hpp" instead, but in my reality, project file locations have nothing to do in c++ source files. It is a configuration matter, not code.

Then there is the cryptic

The default implementation, flymake-proc-get-project-include-dirs-imp, uses a make call.

which says nothing about any requirements for the makefile.
Looking at source code of flymake, it seems to look for something like INCLUDE_DIRS. So, in my Makefile, I wrote:

INCLUDE_DIRS = . ..

But that still does not yield the correct result.
And even if it worked, it is but a half-baked solution, because the Makefile could build multiple targets with different include directories for each of them.

Since using language servers (lsp-mode) is quite common today, maybe there is a convenient solution for flymake to make use of that infrastructure to find out, which project include directories are required.

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

No branches or pull requests

1 participant