Search code examples
gccqmakesuppress-warnings

Is there a possibility to pass includes via -isystem when using qmake


I use qmake as a makefile builder and want to stick to it. Further I would like to use "gcc -Wall -Werror -Wundef -Wextra" to get robust code. I'm thinking about "-pedantic" but that's further up the road. My main problem at the moment are the tons of warnings generated by libraries like boost, parts of qt and the like.

At the moment I use pragmas whenever I include warning-generating headers

    #pragma GCC diagnostic ignored "-Wall"
    #include <QtGui>
    ...
    #include <QWidget>
    #pragma GCC diagnostic error "-Wall"

This is far from cute, rather tedious and cumbersome especially as other programmers have to do so too. Is there an option using qmake that allows to include qt-libraries as system headers, thus supressing their warnings. For plain makefiles and cmake I knwow -isystem but I cannot find a qmake pendant for this.


Solution

  • Easiest way I found is including directly via QMAKE_CXXFLAGS e.g. for Boost this looks like the following in the project file

    QMAKE_CXXFLAGS += -isystem /usr/local/boost_1_44_0