Re: [cedet-semantic] telling semantic about project include directories
Brought to you by:
zappo
From: David E. <de...@ra...> - 2011-12-08 20:14:43
|
Brendan Miller writes: > There seem to be interfaces for specifying "system" include > directories (semantic-add-system-include), but I don't really see any > for project level stuff. That is what EDE is for. :-) Semantic knows about system includes, since those are usually always needed and are not depending on a notion of a 'project' (you can use them with single files). You can skip EDE setup if you're working with very simple setups, like when all files are in one directory, or if you use relative path names in #include directives. But as soon as you're creating slightly more complex projects, you will need EDE. Again, for simple cases you can use canned projects like ede-cpp-root-project. For complex projects, where includes are scattered all over the place, I usually use `ede-locate-global' and/or `ede-locate-locate' so that I don't have to specify every include directory manually. > There's a semanticdb-project-roots function, but setting this doesn't > seem to let semantic properly infer the include path. I'm wondering if > there's a way to set the project include path explicitly. I don't think so. `semanticdb-project-roots' can be a bit confusing; Semantic will not look by default in those directories for includes. Like the name says, all this variable does is hold directories which are roots of separate(!) projects. That means, if you put /home/user/myproject in there, and you load a file /home/user/myproject/subdir/test.c, then Semantic will know that this file is part of that project and load the corresponding table of that directory. Hence, it doesn't make sense to explicitly put 'include' directories in there. Maybe it would make sense to have a separate variable to hold include directories. There actually is `semantic-dependency-include-path'; however, the doc-string says this should be obsoleted, so I guess Eric doesn't want to replicate functionality here. > The internal structure of my project is a little complex, so I'm think > that might have something to do with why semantic isn't guessing the > include path. Even a very minimal EDE setup will get you a long way. For example: (ede-cpp-root-project "whatever" :file "~/myproject/test.cpp" :include-path '( "/include" "/submodule/include" ) :system-include-path '( "/usr/include/" )) ;; Also use 'locate' to find includes. (setq ede-locate-setup-options '(ede-locate-locate ede-locate-base)) Cheers, David |