2.2.2.2 SemanticDB project roots

The project setting in the SemanticDB search throttle (see SemanticDB Search Throttle) tells SemanticDB to search within the current single code project. For Semantic’s point of view, projects are determined by their top-level directories, or project roots; every subdirectory of a project root is considered part of the same project.

If you use EDE for project management, it will set the project roots automatically. See EDE manual. You can also specify them yourself.

Option: semanticdb-project-roots

The value of this variable is a list of directories (strings) that are project roots. All subdirectories of a project root are considered part of the same project. This variable can be overridden by semanticdb-project-root-functions.

Variable: semanticdb-project-root-functions

The value of this variable is a list of functions to determine a given directory’s project root. These functions are called, one at a time, with one argument (the directory name), and must return either nil, a string (the project root), or a list of strings (multiple project roots, for complex systems). The first non-nil return value, if any, is taken to be the project root, overriding semanticdb-project-roots.