Important: Please read the Qt Code of Conduct -

how to change the default value assigned to QMAKE_SPEC (returned when qmake -query) on windows?

  • I am using QT 5.5.1
    i was trying to migrate my project from Visual studio 2008 to 2013.
    i setup QT 5.5.1 and run qmake -tp -r
    in my system, the build goes correctly, and i get .vcxproj files which are compatible to VS 2013,
    but when i do similar things on another machine, the same command builds .vcxproj files which are compatible to VS 2012.

    After some investigation, i found that the QMAKESPEC variable governs this behaviour.
    i found that when i do:
    qmake -query
    i get

    it seemed like, this variable value should have been win32-msvc2013,
    So, i tried to set it by:
    qmake -set QMAKE_SPEC win32-msvc2013
    but this command seems to be creating one more variable with the same name and sets the value of that to win32-msvc2013,
    i.e. if i do:
    qmake -query
    i get:
    and after this too, the build still results in making .vcxproj which are compatible with VS2012 and not VS2013.

  • Hi @Chetan,

    On Linux I've set QMAKE_SPEC via environment variables, eg:

    export QMAKESPEC=linux-clang

    I believe the Windows equivalent would be to use set, eg:

    set QMAKESPEC=win32-msvc2012

    Here's some examples that seem to be doing just that, or something similar:


  • Thanks Paul.
    saw your reply to my question, i was trying to understand the problem, why i didn't need to set QMAKE_SPEC on my Desktop(although the default value of QMAKE_SPEC in qmake -query returned vs2012), it builds vs2013 project files, however on a different machine with same setup it builds vs2012 project files.

Log in to reply