PDA

View Full Version : qmake CONFIG variable - how to retrieve one value



TorAn
11th March 2014, 12:08
I want to retrieve the value of one of the CONFIG parameters that is added (debug or release) to use in directory construction.
For example, I am using TARGET as:


MOC_DIR += $${SolutionDir}/Build/Debug/tempFiles/$$TARGET/mocfiles

I'd like to replace Debug with the value added to the config, so it would look like

MOC_DIR += $${SolutionDir}/Build/$$CONFIG/tempFiles/$$TARGET/mocfiles

What is the best approach? Thanks

anda_skoa
11th March 2014, 12:28
Maybe one of the solutions from here? http://stackoverflow.com/questions/2580934/how-to-specify-different-debug-release-output-directories-in-qmake-pro-file

Cheers,
_

bcastalia
27th August 2014, 06:43
As noted in the link provided by anda_skoa, CONFIG values are typically used with scopes (see Scopes and Conditions in the qmake Advanced Usage section of the qmake manual). Or the CONFIG function (see qmake Function Reference) is used to test for presence of value in the CONFIG list; an optional second paramter can be used to specify the active config (details in the manual).

More generally, any variable may be tested with the contains(variablename, value) function for the presence of a specified vallue. In this way the value is "retrieved" from a list variable.