1
0
mirror of https://github.com/anope/anope.git synced 2026-06-25 13:16:38 +02:00

Move GIT_VERSION define to build.h, otherwise version.h is bumped per commit which forces a rebuild

This commit is contained in:
Adam
2015-02-23 15:47:08 -05:00
parent 94427b234c
commit 7de4b86b7f
+4 -5
View File
@@ -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);