c++qtqmakecompiler-options

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


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?


Solution

  • 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