qmake - how to extract number from variable
Hi All,
In a pro file:
############
VERSION = 1.8.0
# This should be extracted from VERSION (but how?)
VERSION_MAJ = $$find(VERSION, regular expression?)
message($$VERSION_MAJ)
###########
Require VERSION_MAJ to be 1 via the $$find function.
What is the form of the regular expression to achieve required result?
Thanks
Vanir
Re: qmake - how to extract number from variable
Code:
VERSIONS = $$split(VERSION, ".")
VERSION_MAJ = $$member(VERSIONS, 0)
VERSION_MIN = $$member(VERSIONS, 1)
lessThan(VERSION_MAJ, 1) | lessThan(VERSION_MIN, 8) {
error(Project requires version 1.8 or newer but $$VERSION was detected.)
}