[Solved] QMake and optimization flags for compiler



  • I'm using Qt Creator and find out that in default, g++ will use -O2 for compiling phase and -O1 for linking phase. I have add -O3 to both QMAKE_CXXFLAGS and LIBS but end up with there both -O3 -O2 in compiling phase and -O1 -O3 in linking phase. Is there a way to control the optimization flags in .pro files?



  • @
    QMAKE_CXXFLAGS_RELEASE -= -O2
    QMAKE_CXXFLAGS_RELEASE += -O3

    QMAKE_LFLAGS_RELEASE -= -O1
    @
    Make sure you've re-run qmake after modifying your .pro file.



  • Oh. I never thought of "-=" operator. Thank you very much.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.