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

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.


I edited my .pro file by using this, and it worked!

QMAKE_CXXFLAGS_RELEASE  -= -Zc:strictStrings
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -Zc:strictStrings

It does not work:

QMAKE_CFLAGS_RELEASE -= -Zc:strictStrings
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -= -Zc:strictStrings

You can try:

QMAKE_CXXFLAGS_RELEASE  -= -GL -O2
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -GL -O2

Take a look in:

your Qt dir\compiler\mkspecs\win32-msvc2013\qmake.conf


The only way this could work is

QMAKE_CFLAGS -= /GL /O2

but I doubt this works for QMAKE_CFLAGS.

Alternatively, you could redefine QMAKE_CFLAGS, forgetting its previous value:

QMAKE_CFLAGS = $$CFLAGS_WITHOUT_GL_O2