Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the date with qmake

Tags:

date

qmake

Since I'm using today's date for my application version, I'd be interested in filling it automatically.

Currently I'm doing the following in my project file:

VERSION = 15.4.20 

But I'd like to make it automatic:

VERSION = $$YEAR.$$MONTH.$$DAY

Any idea?

like image 633
Martin Delille Avatar asked Dec 08 '25 09:12

Martin Delille


1 Answers

Another option is to use undocumented qmake variable _DATE_, which is available on all platforms:

BUILD_YEAR = $$str_member($${_DATE_}, -4, -1)
message("Build year '$${BUILD_YEAR}' out of '$${_DATE_}'")

See Undocumented QMake

like image 74
matejk Avatar answered Dec 10 '25 11:12

matejk