C++Guns – RoboBlog


GIT SHA hash in QT as macro created at compile time

Filed under: Allgemein — Tags: — Thomas @ 17:11

print git hash in qt as macro created at compile time

This works for me:

.pro File:
DEFINES += GIT_CURRENT_SHA1="\\\"$(shell git rev-parse HEAD)\\\""

C++ File:
std::cout << __DATE__ << " " << __TIME__ << " GIT " << GIT_CURRENT_SHA1 << "\n";

The build directory must be inside the GIT directory of the project.

Nov 2 2019 16:41:22 GIT bf2d25f47afe2c8befcfa6fefb25acbb462d43b3

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress