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. Switching Between Debug and Release Mode in Qt Creator without Modifying Project File
Forum Updated to NodeBB v4.3 + New Features

Switching Between Debug and Release Mode in Qt Creator without Modifying Project File

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
7 Posts 2 Posters 3.9k Views 2 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.
  • C Offline
    C Offline
    Crag_Hack
    wrote on last edited by Crag_Hack
    #1

    Is there any way to switch between debug and release mode in Qt Creator without modifying the project file? It's tedious to have to change the project file every time I switch from compiling in debug mode to test the program and building static for a exe that can be released.
    Thanks!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      1. Remove that from your .pro file.
      2. Hit the green arrow for release build
      3. Hit the the arrow with the bug on it for debug build

      See here

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • C Offline
        C Offline
        Crag_Hack
        wrote on last edited by
        #3

        When I remove from the pro file will static builds compile as release?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Pease show your .pro file content. Without seeing it, it's only a guessing game about what you are currently doing.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Crag_Hack
            wrote on last edited by
            #5

            Here 'tis, the relevant part being CONFIG += static and CONFIG += release. I'd like to be able to switch between compiling debug in Qt Creator and compiling static release for final exe version to be released without having to keep commenting out the CONFIG += lines.
            Thanks again.

            #-------------------------------------------------
            #
            # Project created by QtCreator 2016-05-03T14:13:40
            #
            #-------------------------------------------------
            
            QT       += core gui
            
            greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
            
            TARGET = ReplicatorNew
            TEMPLATE = app
            
            SOURCES += *all cpps here
            
            HEADERS  += *all h's here
            
            FORMS    += \
            *all ui's here
            
            CONFIG += static
            
            CONFIG += release
            
            RC_ICONS = "*icon file here"
            
            RESOURCES += \
               * resource file here
            
            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              You can do build type specific stuff using this construct:

              CONFIG(release, debug|release) {
                  CONFIG += static
              }
              

              Note that you are likely not going to get the result you expect. If you want a fully static application, you have to use fully static dependencies in the first place. This also requires abide to all the constraints related to the license of said dependencies.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              2
              • C Offline
                C Offline
                Crag_Hack
                wrote on last edited by Crag_Hack
                #7

                Sorry and thanks Sgaist I was being lazy and forgot to research first I think I found what I'm looking here and here.
                So I only use static when compiling for deployment. So I put it in my build script and at the QMake step I do:

                qmake "CONFIG += static release" project.pro

                1 Reply Last reply
                1

                • Login

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