Qmake: how to remove compiler flag for a certain project, without changing qmake.conf?

Violet Giraffe picture Violet Giraffe · Nov 23, 2011 · Viewed 12.6k times · Source

I'm using qmake and Visual Studio. In release build qmake adds /GL and /O2 flags to all projects, and I need to remove those two flags for certain libraries within my whole Qt project. Is there a way?

Answer

Gerard Torrent picture Gerard Torrent · Mar 18, 2013

I had a similar problem and I solved it by adding the following directive in the .pro file:

QMAKE_CXXFLAGS_RELEASE -= -g

Observe the _RELEASE suffix, otherwise don't work.