The qt source comes with some examples.
After downloading it from the internet, I go to the examples/painting/concentriccircles and run 'qmake' and it generates the Makefile (which sets CC=gcc) from the .pro file and after make, I can run the demo program concentriccircles on my CentOS machine. (running x86 code).
Now I have a project running Qt on a sparc machine running an OS and I already have the build tree set up. If I move the whole concentriccircles directory to somewhere in the build tree, when I run 'qmake', the generated Makefile sets the CC=sparc-xxx-gcc instead of just plain gcc(which is for x86 host). In fact, without moving the directory, if I run qmake from the sparc build tree, it makes the Makefile for sparc. (regardless of the .pro file)
How does qmake know that I'm building the qt program for sparc machine just from the location where I run qmake? Below is the concentriccircles.pro file.
HEADERS = circlewidget.h \
window.h
SOURCES = circlewidget.cpp \
main.cpp \
window.cpp
# install
target.path = $$[QT_INSTALL_EXAMPLES]/painting/concentriccircles
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS concentriccircles.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/painting/concentriccircles
INSTALLS += target sources
symbian {
TARGET.UID3 = 0xA000A64A
include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
}
maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
Best Answer
First of all you need to know which spec qmake is using by default. You can check this by doing
The result should be path containing all mkspecs i.e.
Now you can check default mkspec:
Result (for my configuration)
So clearly you can see that I have by default linux-g++-64 mkspec
Now let's see what's inside the spec:
Result:
As you can see it includes some other .conf files. In my configuration g++-unix.conf includes simply g++-base.conf so I'll get straight to it:
Result:
As you can see compiler is strictly defined by choosen qmake spec file. You can use different spec file by calling
SPEC_NAME should be directory name inside
qmake -query QMAKE_MKSPECS