Qt compiler flags order

c++, clang, compilation, gcc, qt

Solution

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

Problem

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 ?

Original source