Qmake -> CONFIG variable -> thread
-
Guys, is it necessary to include the following qmake statement:
@
CONFIG += thread
@or
@
CONFIG *= thread
@... when creating other threads?
The "thread":http://qt-project.org/doc/qt-4.8/qmake-variable-reference.html#config CONFIG variable's member does the following as stated by the qmake variable reference:
bq. The target is a multi-threaded application or library. The proper defines and compiler flags will automatically be added to the project.
As far as I can see by:
@
message($$CONFIG)
@... on Windows, the printed output contains:
@
thread_off
@When I add:
@
CONFIG += thread
@... the CONFIG variable contains both "thread_off" and "thread".
Is it necessary to add this statement and if so, is the "thread_off" CONFIG member a standard one that, for instance, explicitly removes the helper utilities added by "thread"?
Is the following code correct:
@
CONFIG -= thread_off
CONFIG *= thread
@ -
The "qmake's exists() conditional function":http://qt-project.org/doc/qt-4.8/qmake-function-reference.html#exists-filename gives an example that contains the qmake's code:
@
CONFIG += thread
@... and it seems that this library is added only on Linux, since the filename starts with "lib" and is followed by lowercase "qt". The same library is not included for Mac OS and all "$(QTDIR)/lib/lib*" files are named "libQt*" - uppercase "Q".
-
Interesting discovery. I have to admit I've never used the "thread" config variable and my threaded applications have always worked. Altough I'm only using them on linux. Maybe Microsoft® Windows® is different there.
-
My multi-threaded ones work as well, but since I have spotted this CONFIG variable's parameter decided that it does something extra.
-
http://community.kde.org/Qt5/Documentation/RenewalProjectOverview#The_Fix_List
Search for the string "CONFIG += qt thread"; that config variable is outdated, and will be removed from Qt 5's documentation.
Multi-threading was enabled by default in Qt 4.0, so that variable is no longer needed.