qmake functions, variables, and conditions

Some qmake variables, functions, and conditions are hard to know their meanings. I list here for a memo.

$$replace(variable, old_string, new_string): replace old_string in variable with new_string.

$$unique(variable): remove duplicated items in variable(a list).

variable *= item: add item to variable(a list) if it is not already there.

variable ~= s,regex,substitution,g: for every item in variable, replace regex with substitution.[reference]

$$reverse(variable): reverse the items in variable. The items in variable is separated with spaces.

$$basename(variable): get the file name part of a full path name.

$$section(_PRO_FILE_, ., 0, 0): get the section 0 to section 0 of _PRO_FILE_ whose sections are separated with .. Note that the first parameter of $$section is a variable name, not variable value. So do not use $$section($$_PRO_FILE_, ., 0, 0). The following usage is wrong: $$section($$basename(_PRO_FILE_), ., 0, 0). Instead, you should use $$section($$list($$basename(_PRO_FILE_)), ., 0, 0), as $$list(value) return a temporary variable name for value.

$$resolve_depends(modules, “QT.”, “.depends”): return all items in modules and their dependent modules. The dependent modules of a particular module are gotten from Qt.module.depends.



If you like my content, please consider buying me a coffee. Buy me a coffeeBuy me a coffee Thank you for your support!
Posted in

Leave a Reply