Qmake: How to Remove Compiler Flag for a Certain Project, Without Changing Qmake.Conf

Qmake: how to remove compiler flag for a certain project, without changing 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

How to remove alter default CFLAGS in qmake?

I succeed removing all flags using those commands:

QMAKE_CXXFLAGS_RELEASE = -Wall -pedantic -fPIC
QMAKE_CFLAGS_RELEASE = -Wall -pedantic -fPIC

How to change qmake release flags for gcc? (Change -O2 to -Os)

You can change global compiler flags by modifying QMAKE_CXXFLAGS. Compiler flags for debug and release builds can be set in QMAKE_CXXFLAGS_DEBUG and QMAKE_CXXFLAGS_RELEASE respectively.

For your concrete example, you should do something like this:

QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -Os

Can qmake configure command line options in a Visual Studio project?

Try with QMAKE_CXXFLAGS:

QMAKE_CXXFLAGS += /MP

It seems to be working - setting that and running qmake -tp vc sets the MP flag in compiler's options.

qmake configuration

Does it help when you add exceptions and rtti to your CONFIG variable?


CONFIG += exceptions rtti

You should probably make sure that your custom Qt build has exception and rtti support enabled:


configure.exe -exceptions -rtti [...]


Related Topics



Leave a reply



Submit