1
votes

A bunch of questions concerning the build process using QtCreator:

In QtCreator, you can differ between a Release, a Debug and a Profiler build. C. f. the following image: The QtCreator window part I refer to

  1. What do these things exactly (!) do? I was not able to find and answer in the internet. Especially, I am interested in whether the Debug mode adds the item "debug" to the qmake variable "CONFIG", the "-g" switch to ask g++ to add debugging information for gdb (my debugger) etc.

  2. Which debugger is meant by "CONFIG += debug": the "normal" debugger GDB (in my case) or the QML Debugger?

  3. Why is it so common to use "+=" in the project file and not "*="? The second variant does not add an item to the qmake Variable if it is already present. Does this mean that multiple equal items in the qmake special variables are harmless?

Many thanks in advance!

1

1 Answers

2
votes
  1. You can see what they do by observing the qmake command line that gets invoked in the "Compiler Output" window pane:

    • Release: qmake MyProject.pro "CONFIG+=qtquickcompiler"
    • Debug: qmake MyProject.pro "CONFIG+=debug" "CONFIG+=qml_debug"
    • Profile: qmake MyProject.pro "CONFIG+=qml_debug" "CONFIG+=qtquickcompiler" "CONFIG+=force_debug_info" "CONFIG+=separate_debug_info"

    gdb has no -g option, did you mean gcc? The effect of CONFIG+=debug is to pass the -g option to gcc, as you can see from this line in Qt/mkspecs/common/gcc-base.conf:

    QMAKE_CFLAGS_DEBUG += -g
    
  2. Compiling a debug build just means your compiled libraries and executables will be unoptimised and contain extra information useful to debuggers. There is no requirement to execute in a specific debugger, or indeed any debugger at all. You could also run a release build in a debugger, although you might find the results less reliable.

  3. Multiple equal items in qmake special variables are usually harmless, and in the case of CONFIG they can even be meaningful. For example, it is legal for CONFIG to contain both debug and release. In this case, the last one in the list will take effect. Consider the difference between += and *= in the following examples:

    CONFIG = debug
    CONFIG += release
    CONFIG += debug   # now CONFIG = debug release debug, so debug is the effective mode
    
    CONFIG = debug
    CONFIG += release
    CONFIG *= debug   # now CONFIG = debug release, so release is the effective mode
    

    There is another reason why *= might not be favoured on the command line: many shells will treat any argument containing * as a file glob/wildcard to be expanded unless it is escaped or quoted.