diff options
Diffstat (limited to 'include/version.cpp')
-rw-r--r-- | include/version.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/include/version.cpp b/include/version.cpp index 119403e13..22921202b 100644 --- a/include/version.cpp +++ b/include/version.cpp @@ -73,7 +73,7 @@ static bool read_version_sh(const std::string &version_sh, std::map<std::string, return true; } -static bool write_build_h(const std::string &buildh) +static bool write_build_h(const std::string &buildh, const std::string &git_version) { std::fstream fd(buildh.c_str(), std::ios::in); @@ -107,6 +107,8 @@ static bool write_build_h(const std::string &buildh) fd << "/* This file is automatically generated by version.cpp - do not edit it! */" << std::endl; fd << build << std::endl; + if (!git_version.empty()) + fd << "#define GIT_VERSION \"" << git_version << "\"" << std::endl; fd.close(); return true; @@ -171,10 +173,7 @@ int main(int argc, char *argv[]) return -1; std::string git_version = get_git_hash(git_dir); - if (!git_version.empty()) - versions["VERSION_GIT"] = '"' + git_version + '"'; - - if (!write_build_h(buildh)) + if (!write_build_h(buildh, git_version)) return -1; read_version_h(versionh, old_versions); |