[Solved] qmake: Where do additional CXXFLAGS come from?
-
wrote on 5 Mar 2014, 12:42 last edited by
I am trying to inhibit a certain warning on GCC. For that I added
@QMAKE_CXXFLAGS += -Wno-switch@At the time I append this inhibition, my QMAKE_CXXFLAGS look like this:
@-pipe@However, in the resulting Makefile, my flags look like this:
@-pipe -Wno-switch -g -fPIC -Wall -W -D_REENTRANT $(DEFINES) @Where do the additional flags come from? I assume that the -Wall later on cancels my request to inhibit that single warning (at least, the warning is still displayed). What can I do?
-
Check out the mkspecs.
-
wrote on 5 Mar 2014, 13:16 last edited by
Right on target!
How do I make my project-specific CXXFLAGS appear after those specified by the mkspecs? Because I do actually want -Wall, except for this one warning.
-
Uh, now that is trickier. I don't know a good answer to this (but there might be one). The first idea that comes to my mind is to modify the mkspecs: but then you will have to remember to use that specific modified version of mkspecs, especially after changing (upgrade) Qt version. The second idea.. what about that "$(DEFINES)" at the end of compiler call? Maybe you can add your flag to that variable?
-
wrote on 5 Mar 2014, 14:09 last edited by
I found a solution:
Do this within the project:
@CONFIG -= warn_on
QMAKE_CFLAGS += $$QMAKE_CFLAGS_WARN_ON
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_WARN_ON
QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_WARN_ON@You now still have all warnings, but they are part of the CXXFLAGS. Anything you append will now effectively inhibit warnings.
-
that is a quite impressive find, thanks for sharing!
1/6