c/c++中将git当前版本信息编译到可执行文件中

使用简单Makefile,则可直接添加宏定义:git CPPFLAGS+=-DGIT_SHA1="$(shell git log --format='[sha1]:%h [author]:%cn [time]:%ci [commit]:%s [branch]:%d' -1)" 使用CMake,在CMakeList.txt中添加:github exec_program(     "git"    
相关文章
相关标签/搜索