I don't know if it's really even possible (see related thread on this forum that had no replies), but the 4.8 documentation says that an environment variable "QMAKESPEC" can be set to specify mkspecs:

The QMAKESPEC environment variable can contain any of the following:
A complete path to a directory containing a qmake.conf file. In this case qmake will open the qmake.conf file from within that directory. If the file does not exist, qmake will exit with an error.
However, while qmake does not exist with an error, setting the QMAKESPEC environment doesn't seem to have any effect:


Qt Code:
  1. davethomaspilot@ubuntu:/usr/share/qt4/mkspecs/linux-arm-g++$ echo $QMAKESPEC
  2. /usr/share/qt4/mkspecs/linux-arm-g++
  3. davethomaspilot@ubuntu:/usr/share/qt4/mkspecs/linux-arm-g++$ ls $QMAKESPEC
  4. qmake.conf qplatformdefs.h
  5. davethomaspilot@ubuntu:/usr/share/qt4/mkspecs/linux-arm-g++$ qmake -query
  6. QT_INSTALL_PREFIX:/usr
  7. QT_INSTALL_DATA:/usr/share/qt4
  8. QT_INSTALL_DOCS:/usr/share/qt4/doc
  9. QT_INSTALL_HEADERS:/usr/include/qt4
  10. QT_INSTALL_LIBS:/usr/lib/x86_64-linux-gnu
  11. QT_INSTALL_BINS:/usr/bin
  12. QT_INSTALL_PLUGINS:/usr/lib/x86_64-linux-gnu/qt4/plugins
  13. QT_INSTALL_IMPORTS:/usr/lib/qt4/imports
  14. QT_INSTALL_TRANSLATIONS:/usr/share/qt4/translations
  15. QT_INSTALL_CONFIGURATION:/etc/xdg
  16. QT_INSTALL_EXAMPLES:/usr/lib/qt4/examples
  17. QT_INSTALL_DEMOS:/usr/lib/qt4/demos
  18. QMAKE_MKSPECS:/usr/share/qt4/mkspecs
  19. QMAKE_VERSION:2.01a
  20. QT_VERSION:4.8.1
To copy to clipboard, switch view to plain text mode 

Here's what's in the qmake.conf in the directory specified by the QMAKESPEC env variable:

#
# qmake configuration for linux-g++
#

MAKEFILE_GENERATOR = UNIX
TARGET_PLATFORM = unix
TEMPLATE = app
CONFIG += qt warn_on release incremental link_prl gdb_dwarf_index
QT += core gui
QMAKE_INCREMENTAL_STYLE = sublib

include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
QMAKE_CC = $CROSS_COMPILE-gcc
QMAKE_CXX = $CROSS_COMPILE-g++
QMAKE_LINK = $CROSS_COMPILE-g++
QMAKE_LINK_SHLIB = $CROSS_COMPILE-g++
QMAKE_AR = $CROSS_COMPILE-ar cr
QMAKE_OBJCOPY = $CROSS_COMPILE-objcopy
QMAKE_STRIP = $CROSS_COMPILE-strip
QMAKE_LFLAGS_RELEASE = -Wl,-O1,-rpath $ROOTFS/usr/lib
QMAKE_INCDIR = $ROOTFS/usr/include
QMAKE_LIBDIR = $ROOTFS/usr/lib
QMAKE_INCDIR_X11 = $ROOTFS/usr/include
QMAKE_LIBDIR_X11 = $ROOTFS/usr/lib
QMAKE_INCDIR_OPENGL = $ROOTFS/usr/include
QMAKE_LIBDIR_OPENGL = $ROOTFS/usr/lib

load(qt_config)
davethomaspilot@ubuntu:/usr/share/qt4/mkspecs/linux-arm-g++$
Can qmake be configured to use different mkspecs after being built?