diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2013-12-09 10:56:31 -0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-20 02:42:31 +0100 |
commit | 0b144bc76a368ecc6c5c1121a1b51e888a0621ac (patch) | |
tree | 7e461a57e9170fb39b935923e227abfff3af583a /qmake/generators/makefiledeps.cpp | |
parent | 6f7d370adec3054656f36b0d2a0777a8a1df3602 (diff) |
Add support for using -isystem in qmake
This commit will make qmake use -isystem automatically for any
compilers that declare support for it for any paths that are listed in
QMAKE_DEFAULT_INCDIRS.
Change-Id: I36fefc6d5bba61671f65669f0ea42704b3c3cf31
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'qmake/generators/makefiledeps.cpp')
-rw-r--r-- | qmake/generators/makefiledeps.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp index df37957f9b..e1fb42e0a4 100644 --- a/qmake/generators/makefiledeps.cpp +++ b/qmake/generators/makefiledeps.cpp @@ -345,6 +345,30 @@ bool QMakeSourceFileInfo::containsSourceFile(const QString &f, SourceFileType ty return false; } +bool QMakeSourceFileInfo::isSystemInclude(const QString &name) +{ + if (QDir::isRelativePath(name)) { + // if we got a relative path here, it's either an -I flag with a relative path + // or an include file we couldn't locate. Either way, conclude it's not + // a system include. + return false; + } + + for (int i = 0; i < systemIncludes.size(); ++i) { + // check if name is located inside the system include dir: + QDir systemDir(systemIncludes.at(i)); + QString relativePath = systemDir.relativeFilePath(name); + + // the relative path might be absolute if we're crossing drives on Windows + if (QDir::isAbsolutePath(relativePath) || relativePath.startsWith("../")) + continue; + debug_msg(5, "File/dir %s is in system dir %s, skipping", + qPrintable(name), qPrintable(systemIncludes.at(i))); + return true; + } + return false; +} + char *QMakeSourceFileInfo::getBuffer(int s) { if(!spare_buffer || spare_buffer_size < s) spare_buffer = (char *)realloc(spare_buffer, spare_buffer_size=s); |