Nominate our 2022 Qt Champions!

Qmake: List of special platform variables

  • Where can I find a documented list of qmake's platform and compiler variables, like:

  • See $QTDIR/mkspecs.

  • The list I get from the folder names in there seems to be incomplete. They do not include e.g. "win32" or "win64" without specifying a specific compiler.

    However, I can still use

    win32 {
    win64 {

    in a .pro file.

    Where is that documented?

    (Specifically, I am looking for a single common variable for "Windows" in general, whether it be 32 or 64 bit).

    [EDIT: code formatting, please wrap in @-tags, Volker]

  • The platform variables resemble closely to the mkspec variants, so for example

    • for a mac, it matches at lesat on unix, macx and one of (macx-g++, macx-g++40, macx-g++42)
    • for windows it matches at least on win32 and one of (win32-g++ or win32-msvc20xx)

  • But there does not seem to be any "win" matching both win32 and win64, or is there?

  • Nope, there's no "win" variable/scope. You can simulate this way:

    win32:CONFIG += win
    win64:CONFIG += win
    win:messag(in scope win)
    win32:messag(in scope win32)
    win32-g++:messag(in scope win32-g++)
    win32-msvc2008:messag(in scope win32-msvc2008)

    This prints "win" too, without the first two lines it does not.

  • Okay, thanks!

  • Guys I have issue that my qmake prints: unix on my Win7 machine

    @win32 {
    win64 {
    macx {

    Any idea what that can be?

  • According you your other "thread": it happens because your target platform is Unix.

  • @Asperamanca, I grep'd through mkspecs, and this is what I have in one of my qt 5.5 installations' mkspec folder:

    $ grep -E -o -r 'QMAKE_PLATFORM.*?$'
    aix-g++/qmake.conf:		QMAKE_PLATFORM          = aix
    aix-g++-64/qmake.conf:		QMAKE_PLATFORM          = aix
    aix-xlc/qmake.conf:		QMAKE_PLATFORM          = aix
    aix-xlc-64/qmake.conf:		QMAKE_PLATFORM          = aix
    android-g++/qmake.conf:		QMAKE_PLATFORM          = android
    blackberry-armle-v7-qcc/qmake.conf:		QMAKE_PLATFORM += blackberry
    blackberry-x86-qcc/qmake.conf:		QMAKE_PLATFORM += blackberry
    common/ios.conf:		QMAKE_PLATFORM         += ios
    common/linux-android.conf:		QMAKE_PLATFORM         += android
    common/linux.conf:		QMAKE_PLATFORM         += linux
    common/mac.conf:		QMAKE_PLATFORM         += mac darwin
    common/macx.conf:		QMAKE_PLATFORM         += osx macx
    common/msvc-desktop.conf:		QMAKE_PLATFORM          = win32
    common/nacl/nacl-base.conf:		QMAKE_PLATFORM          = nacl $$QMAKE_PLATFORM
    common/qcc-base-qnx.conf:		QMAKE_PLATFORM         += qnx
    common/unix.conf:		QMAKE_PLATFORM         += unix posix
    common/wince/qmake.conf:		QMAKE_PLATFORM         += wince win32
    common/winrt_winphone/qmake.conf:		QMAKE_PLATFORM          = winrt win32
    cygwin-g++/qmake.conf:		QMAKE_PLATFORM          = cygwin unix posix
    darwin-g++/qmake.conf:		QMAKE_PLATFORM          = osx macx mac darwin
    features/spec_post.prf:		QMAKE_PLATFORM) {
    features/spec_post.prf:		QMAKE_PLATFORM = unix
    features/spec_post.prf:		QMAKE_PLATFORM = osx macx mac darwin unix
    features/spec_post.prf:		QMAKE_PLATFORM = win32
    features/spec_post.prf:		QMAKE_PLATFORM, macx):!contains(QMAKE_PLATFORM, osx) {
    features/spec_post.prf:		QMAKE_PLATFORM = osx $$QMAKE_PLATFORM
    features/spec_post.prf:		QMAKE_PLATFORM
    freebsd-g++/qmake.conf:		QMAKE_PLATFORM          = freebsd bsd
    freebsd-g++46/qmake.conf:		QMAKE_PLATFORM          = freebsd bsd
    freebsd-icc/qmake.conf:		QMAKE_PLATFORM          = freebsd bsd
    haiku-g++/qmake.conf:		QMAKE_PLATFORM          = haiku
    hpux-acc/qmake.conf:		QMAKE_PLATFORM          = hpux
    hpux-acc-64/qmake.conf:		QMAKE_PLATFORM          = hpux
    hpux-acc-o64/qmake.conf:		QMAKE_PLATFORM          = hpux
    hpux-g++/qmake.conf:		QMAKE_PLATFORM          = hpux
    hpux-g++-64/qmake.conf:		QMAKE_PLATFORM          = hpux
    hpuxi-acc-32/qmake.conf:		QMAKE_PLATFORM          = hpux
    hpuxi-acc-64/qmake.conf:		QMAKE_PLATFORM          = hpux
    hpuxi-g++-64/qmake.conf:		QMAKE_PLATFORM          = hpux
    hurd-g++/qmake.conf:		QMAKE_PLATFORM         += hurd
    irix-cc/qmake.conf:		QMAKE_PLATFORM          = irix
    irix-cc-64/qmake.conf:		QMAKE_PLATFORM          = irix
    irix-g++/qmake.conf:		QMAKE_PLATFORM          = irix
    irix-g++-64/qmake.conf:		QMAKE_PLATFORM          = irix
    linux-cxx/qmake.conf:		QMAKE_PLATFORM          = linux
    linux-kcc/qmake.conf:		QMAKE_PLATFORM          = linux
    linux-pgcc/qmake.conf:		QMAKE_PLATFORM          = linux
    lynxos-g++/qmake.conf:		QMAKE_PLATFORM          = lynxos
    netbsd-g++/qmake.conf:		QMAKE_PLATFORM          = netbsd bsd
    openbsd-g++/qmake.conf:		QMAKE_PLATFORM          = openbsd bsd
    sco-cc/qmake.conf:		QMAKE_PLATFORM          = sco
    sco-g++/qmake.conf:		QMAKE_PLATFORM          = sco
    solaris-cc/qmake.conf:		QMAKE_PLATFORM          = solaris
    solaris-cc-64/qmake.conf:		QMAKE_PLATFORM          = solaris
    solaris-g++/qmake.conf:		QMAKE_PLATFORM          = solaris
    solaris-g++-64/qmake.conf:		QMAKE_PLATFORM          = solaris
    tru64-cxx/qmake.conf:		QMAKE_PLATFORM          = tru64
    tru64-g++/qmake.conf:		QMAKE_PLATFORM          = tru64
    unixware-cc/qmake.conf:		QMAKE_PLATFORM          = unixware
    unixware-g++/qmake.conf:		QMAKE_PLATFORM          = unixware
    unsupported/freebsd-clang/qmake.conf:		QMAKE_PLATFORM          = freebsd bsd
    unsupported/linux-host-g++/qmake.conf:		QMAKE_PLATFORM          = linux
    unsupported/qnx-X11-g++/qmake.conf:		QMAKE_PLATFORM          = qnx
    unsupported/vxworks-ppc-dcc/qmake.conf:		QMAKE_PLATFORM          = vxworks
    unsupported/vxworks-ppc-g++/qmake.conf:		QMAKE_PLATFORM          = vxworks
    unsupported/vxworks-simpentium-dcc/qmake.conf:		QMAKE_PLATFORM          = vxworks
    unsupported/vxworks-simpentium-g++/qmake.conf:		QMAKE_PLATFORM          = vxworks
    win32-g++/qmake.conf:		QMAKE_PLATFORM          = win32 mingw
    win32-icc/qmake.conf:		QMAKE_PLATFORM          = win32
    winphone-arm-msvc2013/qmake.conf:		QMAKE_PLATFORM          = winphone $$QMAKE_PLATFORM
    winphone-x86-msvc2013/qmake.conf:		QMAKE_PLATFORM          = winphone $$QMAKE_PLATFORM

Log in to reply