'When to use qmake eval?
https://doc.qt.io/qt-5/qmake-test-function-reference.html
eval(string)
Evaluates the contents of the string using qmake syntax rules and returns true. Definitions and assignments can be used in the string to modify the values of existing variables or create new definitions.
For example:
eval(TARGET = myapp) {
message($$TARGET)
}
I wondering when/why that should be used? Can't we just use TARGET = myapp directly?
Solution 1:[1]
Well, eval is eval in any interpreted language. It evaluates (or executes) arbitrary string.
s = TARGET = myapp
eval($$s)
message(TARGET is $$TARGET) # TARGET is myapp
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Matt |
