I know there are already resources of printing or returning a git commit hash in VS/C++ with the use of some kind of make based files and some script setup.
But I was wondering if there is a direct way of getting the hash number from git command to the C++ based codes in Visual Studio 2015?
I have created a header file which should return the string of git commit number from the CMakeLists.txt and that function from the header file is being called in a GUI .cpp file labeled as the version name.
But so far this approach is not working. And I was also thinking it is too much work to create a CMake file and a bash setup just to print a git hash.
Let me know if there are better ways to do it in visual studio 2015 in c++.
Thanks for the help.
Also I am trying to return the function value in the following way, which I am not sure if wrong or not.
***std::string functionname()
{ return "@value@";
}