Important: Please read the Qt Code of Conduct -

Should *.pro file be part of my project?

  • Hey.
    What's the common use with the .pro file that's created by qmake?
    Should I:

    1. Use it once, just to create the Makefile, discard it, and from now on edit the Makefile? (so the *.pro will not be tracked by git)
    2. Maintain it is part of my git repository, and every change I want to do in my Makefile should be originated from the *.pro file (by generating new Makefile from *.pro)?

    I've been doing option 2 above up until now but it has a side effect;
    When I clone my git repository from one server to another and then compile (with 'make') - since the make recognize that the file is new - it regenerates the Makefile from the *.pro file, and by that changing it.

    What's the convention?

  • Moderators

    Definitely, 100% option 2.

    When I clone my git repository from one server to another and then compile (with 'make')

    You should always run qmake on such new clone, then make.

    Do not store Makefile in git.

  • @sierdzio Thanks!
    So, git should not track my Makefile, got it.

    How should the build process look like then? Should I have a "build script" that does:

    make clean && make

    and the user will execute if they want to build?

  • Lifetime Qt Champion


    That's not needed. People should rather use out of source builds or will use Qt Creator, just document things properly or point them to the Qt documentation.

  • Thanks @SGaist.
    "use out of source builds" - you mean use the *.pro file?

    I should have probably mention earlier what I mean when I say "user";
    We have an automated system that builds a project with many (mostly CLI) tools, which are used internally in the company.
    My qt project is a submodule in that project, and I need to give the guy who's in charge of that automated system the set of commands that he need to integrate into his build process in order to produce the ultimate binary which is my qt application.
    For now, we only need that binary for Unix (maybe in the future for Win as well).
    So that's why I was thinking about giving him something along the lines of what I wrote above.

  • Moderators

    "out of source" means something like:

    cd ..
    mkdir build
    cd build
    qmake ../source/

    It is a build which does not pollute the source directory with any extra files.

  • Lifetime Qt Champion

    Usually, automated systems like GitLab provide a mean to write these scripts.

    Does your system provide that ?

Log in to reply