Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Issue with qmake release and debug version
Forum Updated to NodeBB v4.3 + New Features

Issue with qmake release and debug version

Scheduled Pinned Locked Moved Qt Creator and other tools
4 Posts 2 Posters 3.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xus2
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xus2
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • X Offline
          X Offline
          xus2
          wrote on last edited by
          #4

          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" )
          }@

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved