Switching Between Debug and Release Mode in Qt Creator without Modifying Project File
-
wrote on 3 Mar 2018, 20:20 last edited by Crag_Hack 3 Mar 2018, 20:21
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! -
Hi,
- Remove that from your .pro file.
- Hit the green arrow for release build
- Hit the the arrow with the bug on it for debug build
See here
-
wrote on 3 Mar 2018, 20:44 last edited by
When I remove from the pro file will static builds compile as release?
-
Pease show your .pro file content. Without seeing it, it's only a guessing game about what you are currently doing.
-
wrote on 3 Mar 2018, 22:30 last edited by
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
-
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.
-
wrote on 4 Mar 2018, 00:01 last edited by Crag_Hack
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/7