Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

Suppress warnings from Qt headers with clang more cleanly

$
0
0
Hi all, On a mac using clang, I’m am making solid progress suppressing Qt warnings that occur as I’m building my code. The answer, I think, is to add the -isystem <dir> argument as a CXX_FLAGS (unfortunately -isystem-prefix appears unsupported by macx clang). Here is something I tried: LIBS_USED_FOR_QT = QtCore QtSql QtMultimediaWidgets QtSensors QtSvg QtXml QtPrintSupport QtWidgets QtQuick QtQml QtPositioning QtGui QtWebKitWidgets   for(somelib, $$list($$LIBS_USED_FOR_QT)) {     QMAKE_CXXFLAGS += -isystem $$(QTDIR)/lib/$${somelib}.framework/Versions/5/Headers     QMAKE_CXXFLAGS += -isystem $$(QTDIR)/lib/$${somelib}.framework/Headers } I did both /Versions/5/Headers and /Headers because I see both show up in warning systems. You also have to be careful to not do this: #include <QtCore/QStringList> and instead do #include <QStringList> … I have no idea why on that point. But I still have 2 problems with my approach: I’m listing out all the libraries I’m using, but I believe there is a Qt variable that has this information. The docs lead me to believe QMAKE_LIBS_QT should have them, but it’s always empty as far as I can tell (I replace QMAKE_LIBS_QT with LIBS_USED_FOR_QT, and nothing at all added to the clang command line). The moc compilation still emits warnings, because mocs use the #include <QtCore/QObject> syntax, which as I mentioned is a problem, but I have no idea why. Any thoughts on how I can do this better? Is someone else doing this already and figured out a better way?

Viewing all articles
Browse latest Browse all 13965

Trending Articles