[Qt-creator] CppTools::ProjectInfo project sources and include paths

Nikolai Kosjar nikolai.kosjar at theqtcompany.com
Tue Feb 3 15:29:48 CET 2015


Hi!

On Mon, 02. Feb 16:51, Roman Nikiforov wrote:
> The problem is that if I have conditions in qmake .pro file and some
> sources and include paths are added only for special configuration, I still
> get all source files from ProjectInfo, but include paths only for active
> configuration. Consequently Lint cannot resolve some includes and stops
> with error.

At the end of the day, your observation describes what the code model
needs. All project files are passed in so they can be indexed (as far
as possible) so that their symbols show up in the locator or e.g.
"Search Symbols". Providing more include paths than for the current
build configuration could lead to subtle/unexpected side effects.

Note that in general you can't just assume that a project is
"buildable"/"analyzable" for all configuration since e.g. some headers
are only available on certain platforms. That is, getting all include
paths wouldn't help you here for the general case. It seems better to
analyze only the files that are part of the current build
configuration.

[For qmake projects:]
Unfortunately I don't see a way how to find out whether a file is part
of the current build configuration or not. We get the files via e.g.

    "pro->variableValue(CppSourceVar)"

in QmakeProject::updateCppCodeModel() and this seem to contain *all*
files of the project, independent of the configuration.

@Daniel: Is there a way to get only the files that are selected by the
build configuration?

Nikolai




More information about the Qt-creator mailing list