Issue with qmake release and debug version



  • Hi guys,

    i want to be able to build the debug and the release version of my program in the following way.

    If i just type qmake in the console i want to build the makefiles for the debug version. However when i type qmake CONFIG+="release" i want to build the release version.

    I have tried several options but I always stuck at the same point. If i add to my .pro file CONFIG -= release it builds me the debug version in the default case, which would be perfect. However, if i type qmake CONFIG+="release" then this does not have any effect, since the CONFIG -= release overwrites the setting again :(

    Can someone help me with this? How can i specify that any parameter given from outside overwrites the corresponding parameter in a .pro file?

    Thanks in advance,
    XuS


  • Moderators

    Why do you have your .pro-file overwrite what the user does in the first place? Just do not set either debug and release and there should be no problem;-)

    The default kind of build used by qmake is actually based on your Qt version. If that is configured to be a debug version, then qmake will default to a debug build. If it is a release built, then qmake will use a release.

    If you configured Qt to be "debug and release", then it will default to whatever else you give. So "debug-and-release" followed by "debug" will have qmake default to debug, "debug-and-release" followed by "release" to release. Way too much magic here for my taste... I would really prefer if it would always do debug builds if possible.



  • The thing is the user may not set anything. I just use qmake as a build tool to generate the make files for an open soruce project. So, there might not be any other qt-stuff installed. Per default i want to build the debug version without requiring anyone to specify something. However, if the user wants to use the program in the field he would have to specify that with adding CONFIG+="release" when calling qmake.



  • Hey i have found an solution to my problem. I have introduced another variable and check it inside the .pro file. If its not set i build the debug version else i build the release version. Here is the code:

    @# to build the release version call qmake CONFIG+=my_release

    CONFIG -= debug_and_release
    CONFIG -= release
    CONFIG += debug

    contains(CONFIG, my_release) {
    CONFIG -= debug
    CONFIG += release
    }

    CONFIG(debug, debug|release) {
    message( "Building the DEBUG Version" )
    } else {
    message( "Building the RELEASE Version" )
    }@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.