Automatically extract gcc -I paths for indexing source code in Emacs

After reading:

I find out that when creating a project folder with an existing make file and source code, I can semantic index files either

  • defining a simple EDE project with:

    (ede-cpp-root-project ... :system-include-path '( "~/exp/include/boost_1_37" )

  • or by indicating the included paths to semantics directly using

    (semantic-add-system-include "~/exp/include/boost_1_37" 'c++-mode)

But it still requires me to type the paths manually . Is there a way to automatically extract include paths for semantics from an existing make file ?

Background: Some IDEs have a feature to automatically detect gcc -I paths from an existing make file. For example, in Eclipse, you can create a project along the path with the existing make file and source code, and Eclipse would display the included paths for its "intellisense" when building the project (I suppose Eclipse parses GNU make output to do this). I would like to do the same in Emacs.

+6
source share
1 answer

The answer is yes: there is a way to open this path. AFAIK code for it has not yet been written (maybe I'm wrong on this). All you have to do is run make -n and find "-I" in the output. Of course, the devil is in the details, but it should be quite easy to write a proof of concept.

+1
source

Source: https://habr.com/ru/post/927514/


All Articles