Adding build date to linux project
-
I found this online:
https://www.qtcentre.org/threads/5192-show-build-date-in-about-box
In my .pro file I added:
DEFINES += "BUILDDATE=system(date +'%d-%m-%y %T')"
However this results in an error:
[main.o] Error 2
Not terribly helpful, but that's all it shows, if I comment out the DEFINES and rebuild it will build without the error.
How do I solve this?
-
$$system()
notsystem()
.Here is a working example: https://github.com/milosolutions/mwizardtemplate/blob/master/version.pri
-
My entry now reads:
DEFINES += "BUILDDATE=$$system(date +\"%d-%m-%y %T\")"
Now I get:
No such file or directory File not found: arm-argo-linux-gnueabi-g++: 0906
Also keep in mind, I'm developing on Linux not Windows.
[Edit] Solved, changed line to:
DEFINES += BUILDDATE=$$system(date +"%d-%m-%y %T")
[Edit 2] Actually, not completely solved, although the application now compiles, I still get no build date:
QString strBldDate(BUILDDATE);
Its empty.
-
-
Is there any good source of information or tutorial on how to use definitions in the .pro file?
I've been told I can use message() in a .pro file and I have to view:
message($$system(date +\"\\\"%d-%m-%y %T\\\"\")
And this works well, I can see in the General Messages pane when I build something like:
Project MESSAGE: "26-06-19 10:55:11"
How can I use this to review the content of a definition? I've tried:
message(BUILDDATE)
Just results in:
Project MESSAGE: BUILDDATE
I also tried:
message($$BUILDDATE)
The result is:
Project MESSAGE:
So if the last one is correct, nothing is being assigned to BUILDDATE, how do I fix this?
-
You can print whole DEFINES like this:
message($$DEFINES)
-
@SPlatten said in Adding build date to linux project:
but won't that only give the date and time of the source file that its implemented in
https://www.cprogramming.com/reference/preprocessor/__DATE__.html
"__DATE__ is a preprocessor macro that expands to current date (at compile time)"