Old question, but still worth an up-to-date answer. Today it's common to do what Qt Creator does when shadow builds are used (they are enabled by default when opening a new project).
For each different build target and type, the right qmake
is run with right arguments in a different build directory. Then that is just built with simple make
.
So, imaginary directory structure might look like this.
/
|_/build-mylib-qt5-mingw32-debug
|_/build-mylib-qt5-mingw32-release
|_/build-mylib-qt4-msvc2010-debug
|_/build-mylib-qt4-msvc2010-release
|_/build-mylib-qt5-arm-debug
|_/build-mylib-qt5-arm-release
|_/mylib
|_/include
|_/src
|_/resources
And the improtant thing is, a qmake
is run in the build directory:
cd build-mylib-XXXX
/path/to/right/qmake ../mylib/mylib.pro CONFIG+=buildtype ...
Then it generates makefiles in build directory, and then make
will generate files under it too. There is no risk of different versions getting mixed up, as long as qmake is never run in the source directory (if it is, better clean it up well!).
And when done like this, the .pro
file from currently accepted answer is even simpler:
HEADERS += src/dialogs.h
SOURCES += src/main.cpp \
src/dialogs.cpp