Reputation: 1903
My goal is to get rid of some types of compiler warnings. I found out that I can do that by adding compiler flags in my .pro file:
QMAKE_CXXFLAGS += -Wno-unused-variable -Wno-reorder
The problem is that they are added before flags that are generated by Qt build system. I've examined my compiler output:
g++-4.2 -c -pipe -Wno-unused-variable -Wno-reorder -g -gdwarf-2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB
So as you can see -Wall goes after my flags and discards them. What should I do to add those flags after ?
Upvotes: 4
Views: 1283
Reputation: 61656
Don't use QMAKE_CXXFLAGS
but rather override QMAKE_CXXFLAGS_WARN_ON
with your own warnings:
QMAKE_CXXFLAGS_WARN_ON = -Wno-unused-variable -Wno-reorder
Upvotes: 6