Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QT Creator's .pro file - where is the debug/release intelligence



  • I'm learning about qmake files now, and read the online docs. I assumed that when I create a new project in QT Creator that it would create all kinds of config debug/release logic in the pro file for me.

    However, when I looked a pro file I created for a project, the .pro file has nothing like this (very simple). So where does QT Creator put all the settings to do with debug/release for my project?

    On that note, if I wanted to compile from the command line, would I have to manually add some settings to my .pro file so it can handle debug/release?



  • Qt creator does create one .pro file used for release and debug configuration.
    The switching between debug and release modes is done when qmake is called internally with command line parameters.

    Go to the left bar to the projects button. under tab "Build&Run" you can see the actual parameters used for the qmake run. You can change between release and debug modes there.

    BTW: it is Qt. The two upper case letters (QT) stand for Quick Time at least in devnet



  • Although I am creating the app in Qt Creator, I will eventually have to compile from the command line on different OS's. Is there a standard way of adding debug/release or other platform info to a .pro file?


  • Moderators

    EDIT: I stand corrected by WoJo below



  • yes, there is. for example, different names for debug and releas build (appnameD.exe <-> appname.exe) modify the pro file like:

    @debug: TARGET = appnameD
    release: TARGET = appname@

    or:
    @debug {
    TARGET = appnameD
    }
    release {
    TARGET = appname
    }@

    To build from command line, just call:
    Debug build:
    @qmake
    make debug@

    Release Build:
    @qmake
    make release@



  • Cool - I'll start with this and then add some other qmake config lines I found on stackoverflow... thanks





  • don't use

    @debug: TARGET = appnameD@

    The correct thing to do is

    @CONFIG(debug, debug | release): TARGET = appnameD@

    see http://qt-project.org/doc/qt-4.8/qmake-variable-reference.html#config


Log in to reply