Nominate our 2022 Qt Champions!

How do I create a custom qmake template?

  • Is it possible to create a custom qmake template and add it to the list of templates used by the Qt Creator project wizard?

    I see that it is possible to create a empty application skeleton and reuse it via open/save-as, like in this example:

    "qmake template":

    but this is not what I'm looking for. I'm wondering if it is possible to create a real qmake template, that is the kind of "native" template you can add to the project wizard of Qt Creator.

    I have got the feeling that this could be possible, maybe using the qmake "features" and their .prf files, but I cannot see how to do it.

    Is it possible? How?
    Any idea/suggestion?
    Any documentation? (Put aside the excellent "undocumented qmake" and the fine Qt official documentation)
    Any example?


  • qmake is just a build system: It takes code and produces binaries out of that.

    Creator has templates that produce (skeleton-) code. Some of that code includes instructions on how to build it using qmake.

    Do you want to generate binaries for a different platform? That would be something requiring adding mkspecs to qmake. Do you want to have something new show up in Qt Creator's "New File or Project" dialog? Then "check out the manual": of Qt Creator then. For more advanced templates you might need to do some programming though;-)

  • Thanks Tobias,
    the "Adding New Custom Wizards": page is exactly what I was looking for.

    Moreover, I was looking it exactly for this reason: "If you have a team working on a large application or several applications, you might want to standardize the way the team members create projects and classes." (excerpt taken from the mentioned page). I have to write a few strongly-related applications and I hoped to find a way to standardize the development process.

    Most likely, I will just use templates. In any case, the possibility to use generator scripts is an interesting plus.

    I'm not going to build binaries for new (different) platforms so I'm not going to touch the mkspecs files (at least, not for now).

    BTW: qmake is fine for me, at least for the moment. For more complex needs, I already had a look at cmake, scons and qbs. I will not run out of alternatives... :-)

    Your new Qt Build System (qbs) seems to be very smart and very promising. Thanks for having developed it (even if, maybe, a new build system was not the most urgent need of Qt...).

    Thanks again.

Log in to reply