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