I am trying to pass gcc optimization flags using the qmake.pro file:
hello.pro:
TEMPLATE = app CONFIG += console CONFIG -= app_bundle CONFIG -= qt SOURCES += main.cpp QMAKE_CXXFLAGS += -O3 \
main.cpp:
#include <iostream> int main() { std::cout << "Hi!" << std::endl; return 0; }
compilation output:
15:14:34: Running steps for the TestGrounds project ...
15:14:34: Start:
"/ usr / bin / make" clean rm -f main.o
rm -f * ~ core * .core
15:14:34: The process "/ usr / bin / make" went fine.
15:14:34: The configuration has not changed, skipping the qmake step.
15:14:34: Start: "/ usr / bin / make"
g ++ -c -pipe -O3 -O2 -Wall -W -fPIE -I / opt / Qt5.2.0 / 5.2.0 / gcc / mkspecs / linux-g ++ -I ../../ Projects / TestGrounds -I. -o main.o ../../ Projects / TestGrounds / main.cpp
g ++ -Wl, -O1 -Wl, -rpath, / opt / Qt5.2.0 / 5.2.0 / gcc -o TestGrounds main.o
15:14:35: The process "/ usr / bin / make" went fine.
15:14:35: Elapsed time: 00:01.
But why do the optimization flags -O1 and -O2 exist?
I tried to clean the project and rebuild it, and the result will be the same.
c ++ gcc qmake
Martin Drozdik
source share