GUI: Fix order of project/global include directories.
Per project include directories must be added to the list before the global include directories. Include directories are searched in listed order. So placing per project include directories first we ensure per project include file is found instead of the global include file if same file exist in both.
This commit is contained in:
parent
9539d22a1a
commit
19b7468bb6
|
@ -447,13 +447,6 @@ Settings MainWindow::GetCppcheckSettings()
|
||||||
{
|
{
|
||||||
Settings result;
|
Settings result;
|
||||||
|
|
||||||
QString globalIncludes = mSettings->value(SETTINGS_GLOBAL_INCLUDE_PATHS).toString();
|
|
||||||
if (!globalIncludes.isEmpty())
|
|
||||||
{
|
|
||||||
QStringList includes = globalIncludes.split(";");
|
|
||||||
AddIncludeDirs(includes, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If project file loaded, read settings from it
|
// If project file loaded, read settings from it
|
||||||
if (mProject)
|
if (mProject)
|
||||||
{
|
{
|
||||||
|
@ -471,6 +464,16 @@ Settings MainWindow::GetCppcheckSettings()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Include directories (and files) are searched in listed order.
|
||||||
|
// Global include directories must be added AFTER the per project include
|
||||||
|
// directories so per project include directories can override global ones.
|
||||||
|
const QString globalIncludes = mSettings->value(SETTINGS_GLOBAL_INCLUDE_PATHS).toString();
|
||||||
|
if (!globalIncludes.isEmpty())
|
||||||
|
{
|
||||||
|
QStringList includes = globalIncludes.split(";");
|
||||||
|
AddIncludeDirs(includes, result);
|
||||||
|
}
|
||||||
|
|
||||||
result.addEnabled("style");
|
result.addEnabled("style");
|
||||||
result.addEnabled("information");
|
result.addEnabled("information");
|
||||||
result.addEnabled("missingInclude");
|
result.addEnabled("missingInclude");
|
||||||
|
|
Loading…
Reference in New Issue