May 2, 2012

herophuong herophuong
Lab Rat
14 posts

[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?

2 replies

May 2, 2012

Lukas Geyer Lukas Geyer
Lab Rat
2074 posts

  1. QMAKE_CXXFLAGS_RELEASE -= -O2
  2. QMAKE_CXXFLAGS_RELEASE += -O3
  3.  
  4. QMAKE_LFLAGS_RELEASE -= -O1

Make sure you’ve re-run qmake after modifying your .pro file.

May 2, 2012

herophuong herophuong
Lab Rat
14 posts

Oh. I never thought of “-=” operator. Thank you very much.

 
  ‹‹ Adding Sources to QtCreator 2.4.1      11.5 GB of tools which do... nothing? ››

You must log in to post a reply. Not a member yet? Register here!